• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/25

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

25 Cards in this Set

  • Front
  • Back

Operators - Compound Assignment

+= x+=5 is the same as x = x + 5


-= x-=5 is the same as x = x - 5


*= x*=5 is the same as x = x * 5


/= x/=5 is the same as x = x / 5

Operators - Increment and Decrement

++ x++ is the same as x = x +1 or x+=1


-- x-- is the same as x = x - 1 or x-=1

Operators - Relational and Comparison

== equal to


!= not equal


< less than


> greater than


<= less than or equal to


>= greater than or equal to

bool

Holds true or false


bool test = true;


if(test)

char

Holds a single character


char test = 'a';



int

Holds an integer(whole number)


int test = 12;



float

Holds a single-precision floating point value


float test = 1.000045;





double

Holds a double-precision floating point value


double test = 1.000000000006;



Operators - Arithmetic

Addition +

Subtraction -


Multiplication *


Division /


Modulus %



Operators - Assignment

=


x = 3;


Always works from right to left

Operators - Logical

! not


&& and


|| or

Decision making statements

if


switch


? : - conditional

Loops

for


while


do while

for loop

for(int i = 0; i < x; i++)


{


}


Use when you want x number of loops

while loop

while( x < 5)


{


}


Use when you want to loop until a condition is met

do while loops

do


{


}while ( x < 5)


Use when the code in the loop MUST run at least once before a condition is met

if

if(x == 3) Must be a Boolean expression


{ ( equal to true or false)


}


else


{


}

switch

switch(test)


{ Used to compare to a list of values


case 1:


code;


break;


default:


code;


}

? : Conditional

Same as if but can be used inline


cout << ( i > j ? i : j ) << " is greater." << endl;

Function

a group of statements that is given a name, and which can be called from some point of the program




must be declared before its used

cin

Used to get input from the console


cin >> x;


can use for multiple inputs separated by spaces


cin >> x >> y >> z;

getline

Used to input a string with spaces


getline(cin, x);




must use cin.ignore(); before if its after a cin

cout

Used to output to the console


cout <<"hello world";




cout << x << " + " << y << " is " << x + y;

string

Data type that holds a sequence of characters




must #include



Array

A variable that holds a series of values of the same data type


int test [3] = { 1, 2, 3};




for(int x = 0; x < test.size(); x++){


cout << test[x] << endl;


}