Term
|
Definition
//comment /*comment comment*/ |
|
|
Term
|
Definition
iostream library using namespace std cout<cin>>x |
|
|
Term
|
Definition
#ifndef #define //declarations #endif |
|
|
Term
|
Definition
#define indentifier replacement #define YEN_PER_DOLLAR 127 |
|
|
Term
|
Definition
shows num of bytes in type or variable iostream library |
|
|
Term
|
Definition
holds neg and pos nums from -128 to 127 |
|
|
Term
|
Definition
holds only pos nums from 0 to 255 |
|
|
Term
|
Definition
|
|
Term
|
Definition
char chchar=97; cout chchar; will print a use int cast to print number cout (int)chchar; |
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
\b moves cursor back a space |
|
|
Term
|
Definition
\f moves cursor to next page |
|
|
Term
|
Definition
\r moves cursor to beggining of line |
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
x%=y put remainder of x/y in x |
|
|
Term
|
Definition
++x increment x, thenevaluate x |
|
|
Term
|
Definition
--x decrement x, then evaluate x |
|
|
Term
|
Definition
x++ evaluate x,then increment |
|
|
Term
|
Definition
x-- evaluate x,then decrement |
|
|
Term
|
Definition
x,y evalute x then y, return value of y |
|
|
Term
|
Definition
c?x:y if c is true then x, otherwise y |
|
|
Term
|
Definition
|
|
Term
|
Definition
x&&y true only if both are truee |
|
|
Term
|
Definition
x||y true if either x or y are true |
|
|
Term
|
Definition
x<x>>y all bits in x shifted right y bits (binary 1's shifted,if pushed off end,lost) |
|
|
Term
|
Definition
~x all bits in x flipped 0110=x ~x=1001 |
|
|
Term
|
Definition
x&y 0 1 0 1 // 5 0 1 1 0 // 6 0 1 0 0 adds to one if both are ones |
|
|
Term
|
Definition
x|y 0 1 0 1 // 5 0 1 1 0 // 6 0 1 1 1 adds to one if either has one |
|
|
Term
|
Definition
x^y 0 1 0 1 // 5 0 1 1 0 // 6 0 0 1 1 ony evals to one if only one of them has a one |
|
|
Term
|
Definition
makes global variable file scope or if applied to variable in a block makes it fixed duration so it stays after block is destroyed |
|
|
Term
|
Definition
changes type int x = 10; int y = 4; float fValue = (float)x /y; |
|
|
Term
|
Definition
float fValue = static_cast(nValue1) / nValue2; -only does standard type conversions |
|
|
Term
|
Definition
way to create own data type ex. enum Color {COLOR_BLACK COLOR_GREY} dec enum var- Color ecolor =COLOR_GREY automatically recives num value |
|
|
Term
|
Definition
allows alias for data type ex. typedef long miles; |
|
|
Term
|
Definition
group variables of mixed data types together into a single unit ex. struct Employee { int nID; int nAge; float fWage; }; Employee sFrank; // create an Employee struct for Frank sFrank.nID = 15; sFrank.nAge = 28; sFrank.fWage = 18.27; |
|
|
Term
|
Definition
if (expression) statement use block{} for multiple statements add else if, and else for more possiilites |
|
|
Term
|
Definition
for multiple conditions switch (cChar) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return true; default: return false; } |
|
|
Term
|
Definition
makes cpu jump to another spot in code
statmentlabel:lots of code goto statementlabel; |
|
|
Term
|
Definition
while (expression) statement; - |
|
|
Term
|
Definition
do statement; while (condition); |
|
|
Term
|
Definition
for (init-statement; expr1; expr2) statement; for (int iii=0; iii < 10; iii++) cout << iii << " "; multiple declarations: for (int iii=0, jjj=9; iii < 10; iii++, jjj--) cout << iii << " " << jjj << endl; |
|
|
Term
|
Definition
access multiple variables through one index ex. int anTestScores[30]; // allocate 30 integers int anTestscores[0]=69; |
|
|
Term
non-constant integer arrays |
|
Definition
const int nArraySize = 5; int anArray[nArraySize]; |
|
|
Term
|
Definition
int anArray[5] = { 3, 2, 7, 5, 8 }; if not intialized-equal 0 |
|
|
Term
|
Definition
enum StudentNames { KENNY, // 0 KYLE, // 1 STAN, // 2 BUTTERS, // 3 CARTMAN, // 4 MAX_STUDENTS // 5 }; int anTestScores[MAX_STUDENTS]; // allocate 5 integers anTestScores[STAN] = 76; |
|
|