Chapter 3 Flashcards
(25 cards)
standard input object; reads input from console / keyboard; automatically converts data from keyboard to data type of variable used to store it
cin
stream extraction operator; gets characters from stream object on its left and stores them on variable who’s name appears on its right
> > (two arrow heads pointing to right)
area of memory where user values are first stored
keyboard buffer
prgrmming statement that has a value, usually consists of an operator and its operand; don’t have to be mathematical
expression
dets what goes first when multiple mathematical exps are in use; considered after parantheses
precedence
precedence table
unary operators, arithmetic operators, relational operators, logical operators, assignment operators
either L to R or R to L depending on operator; considered after precedence
associativity
a routine that performs a specific operation
library function
library fcn whose purpose is to raise a number to a pwr; data types and variable used to store return value must be doubles; requires use of cmath header file
pow
data types from highest to lowest
long double, double, float, unsigned long, long, unsigned int, int
when C++ converts operands so the data types they belong to are same type; happens according to these rules: 1) chars, shorts, and unsigned shorts are autoly converted to ints 2) when operator works w/ 2 values of dif data types, conversion takes place b4 operation 3) when final value is assigned to variable it will be converted to data type of variable
type conversion
when value is converted to higher data type
promoted
when value is converted to lower data type
demoted
when value assigned to variable is too large/too small for its data type; for integer, contents wrap around to next value; for floating-pt variables, results depend on how compiler is configured (error messages, stops, choice of behaviors, etc.)
overflow/underflow
lets you manually promote/demote a value; original value is not changed but a copy is converted and stored in dif data type variable/literal
type cast expression; general format: static_cast (value [variable or literal] you want to cast)
compound operators; arithmetic assignment operators; have lower precedence than regular math operators
combined assignment operators
way a value is printed; can be controlled in C++
formatting
stream manipulator that’s used to estb print fields of a specified width; requires iomanip; can be used w/any data type; by default includes position for decimal pt of floating pt number and space in string
setw(n)
min # of spaces /character positions on screen to print value in
field width
total # of digits tht appear b4 and after the decimal point
sig figs or precision
stream manipulator that controls number of sig digits w/which floating-pt values are displayed by; comes directly after value you want to affect; values will be rounded to number of set sig figs; will have no effect if value has less than specified # of digits
setprecision
stream manipulator that forces cout to print digits in fixed-point notation (decimal format)
fixed; format: cout «_space;setprecision(#digitsyouwantbehinddecimal) «_space;fixed
stream manipulator that allows you to pad numbers w/ trailing zeros, even if there isn’t a fractional part
showpoint
stream manipulators that enable to change justification of output; will stay the same until you change it
left and right manipulators