TYPES int - whole numbers double - any numbers string - "usually human-readable messages is double quotes" remember the special characters \n, \t, etc. bool - true or false OPERATORS ( ) round brackets may be used in the usual way to overcome priorities highest priority: [] () . (dot) next highest: ! ~ + - "unary" operators next: * / % next: + - next: << >> (not yet) next: < <= >= > next: == != next: & (not yet) next: ^ (not yet) next: | (not yet) next: && next: || almost lowest: = (don't use it!) lowest priority: , (comma) (a very bad idea) when operators have the same priority, they are performed LEFT to RIGHT. ARITHMETIC OPERATORS + - * / add subtract multiply divide work on ints and doubles two int inputs will produce an int result 999/100 is 9. No rounding two doubles produce a double result mixed inputs: the smaller (int) is converted first. % only works on two ints, and produces in int result the remainder after doing a division 123 / 10 is 12. 12 % 10 is 3. STRING OPERATORS + between two strings, produces another string consisting of the two inputs joined together "cat" + "a" + "comb" = "catacomb" (if you try that experiment as-is, it will seem not to work) . there are a few dot operations you can do with strings. For example, if s is a string: s.length() is its length (total number of characters) [] indexing, string[int] lets you access individual characters, start counting from zero at the left: "Greetings, Human."[9] is the comma RELATIONAL OPERATORS < less than > greater than <= less than or equal to >= greater than or equal to == equal != not equal always deliver a bool result. can be used between any kinds of numbers (ints or doubles mixed freely) or between two strings ("alphabetical" ordering like in a dictionary) FUNCTIONS () We are busily learning about these at the moment, they come in all shapes and sizes. Here's one useful example: sqrt(x) calculates the square root of x, it expects its input to be a double (but it will accept an int) and produces a double result print(sqrt(81.0)) prints 9 BOOLEAN OPERATORS if a number is used where a bool is expected, 0 is taken as false anything else is taken as true if a bool is used where a number is expected, false is zero true is 1 && logical and needs both operands to be true || logical or needs any operand to be true ! logical not opposite of operand false && anything is false true && false is false true && true is true true || anything is true false || true is true false || false is false ! true is false ! false is true in the case of "false && anything", C++ won't even look at the "anything", if (sqrt(x) < 7.5) print("Small!\n"); could go wrong. What is x is negative? sqrt() can't handle that, if (x >= 0.0 && sqrt(x) < 7.5) print("Small!\n"); is perfectly safe. BIT-WISE OPERATORS only make sense when you consider their inputs in binary they take only ints and deliver int results & a bit in the result is 1 only if the corresponding bit in both inputs is 1 (zero otherwise of course) | a bit in the result is 1 if the corresponding bit in either of the inputs is 1 ^ a bit in the result is 1 only if the corresponding bits in the two inputs are different ~ has only one input. Each bit of the result is the opposite of the corresponding bit in the input << X << N shifts all the bits of X to the left by N positions, the N leftmost bits are lost, N zeros are inserted at the right >> X >> N shifts all the bits of X to the right by N positions, the N rightmost bits are lost, N zeros are inserted at the left when dealing with ints, X << N produces the value X times 2 to the power of N and X >> N produces the value X divided by 2 to the power of N examples in binary 0001010101 (85) & 0000110011 (51) ----------------- 0000010001 (17) 0001010101 (85) | 0000110011 (51) ----------------- 0001110111 (119) 0001010101 (85) ^ 0000110011 (51) ----------------- 0001100110 (102) ~ 0000101101 (45) ----------------- 1111010010 (big) TERRIBLE COMMA A , B work out the value of A, ignore it, work out the value of B, that's the answer. That is really what it means, EXCEPT when it is used to separate the inputs in a function call.