C++ Deck 6 Flashcards
What type of value does double store?
Standard floating-point that holds fractional data.
Memory Size: double
8 bytes
Signed or Unsigned: double
Signed / Unsigned: -1.7x10^-308 to +1.7x10^308
What type of value does long double hold?
Quadruple precision floating-point for fractional numbers. May not be available on all machines.
Memory Size: long double
16 bytes
Signed or Unsigned: long double
Same as double, but with more digits after the decimal point (for higher precision)
The 4 main Identifier (variable) style conventions.
- Start names with a letter (not an underscore).
- Should be meaningful / self-documenting
- Don’t use special characters
- Don’t use keywords / reserved words
What is a constant variable?
A variable declared to be an immutable value. It cannot be changed at any time after initialization. It MUST be initialized when declared (on the same line).
Uses the keyword “const” followed by the data type and then the variable and initialized assignment value.
Constant variable is usually in all caps.
const double PI = 3.14;
What is the meaning of the Escape Sequence: \n
new line
What is the meaning of the Escape Sequence: \t
tab
What is the meaning of the Escape Sequence: "
double quote
What is the meaning of the Escape Sequence: '
single quote
What is the meaning of the Escape Sequence: \
backslash
What would a c++ line that outputs a precise floating point value rounded to 3 decimal places look like?
cout «_space;fixed «_space;setprecision(3);
The 4 parts of a loop.
- Initialization
- Condition
- Loop Body
- Increment/Decrement