Ch 3
get function
-Inputs next character (including whitespace) -Stores in memory location indicated by its argument (parameter) Syntax: cin.get (varChar); varChar is any character value
If...else
If the possible range of values for a multiple selection statement can't be reduced to a finite set of values, you must use the _____ structure
scientific notation
In c++, the default output of floating point numbers is
Scientific
The manipulator _____ is used to output floating point numbers in scientific format
unary
The operator ! is_____ so it only has one operant
Setfill
The output stream variables can use the manipulator ____ to fill the unused columns with a character other than a space. ) Ex: cout << setfill ('#')
input failure
The result of trying to read invalid data. (Ex: entering a char into an int)
cassert
The specification of the assert function is found in the header file ____.
Integral
The value of the expression in a switch statement must be a
getline
To read a string containing blanks, you can use function _____
iomanip
To use a parmeterized stream manipulator in c++, you must use
-function name -number of parameters required -type of each parameter -what the function will do
To use a predefined function, you need appropriate header file and know:
dot notation
Used to separate a input stream variable name from its member/function name
istream
Variables of type ____ are called input stream variables.
With parameters and without parameters
What are the two type of manipulators.
showpoint manipulator
forces output to show the decimal point and trailing zeros
setprecision manipulator
formats the output of floating-point numbers to a specified number of decimal places. Requires header file iomanip Syntax: setprecision (n)
member access operator
the dot operator in C++
fail state
the state an input stream enters after input failure in which all further I/O statements using that stream are ignored
break statement
A statement that terminates a loop or switch statement.
I/O functions are typically called ____ member functions
Stream
equality operator
==
File
A ____ is an area in secondary storage used to hold information
Function parameters
Another name for function arguments
Evaluates a logical expression
Any non zero is treated as true when
ignore function
Discards a portion of the input Syntax: cin.ignore (intExp, chExp); If intExp is value m, then it ignores the next m characters or all until character specified by chExp
logical operators
Enable you to combine logical expressions
(cin)
Given the input stream variable cin, the ex press ion ____ evaluates to true if the last input succeeded.
! Operator
Has the highest order of precedence
pow
Has two parameters. Using header file cmath. Syntax pow (x, y) = x^y.
-expression is evaluated -value is printed -manipulator is used to format output (ex; endl)
How does cout work
-output is right justified -unused columns are filled with spaces
If a number of columns exceeds number of columns required, then:
Cout statements
Logic errors are not caught, so what can you use to spot and correct it?
Compound statement
Permits more than one statement to execute if an expression evaluates to true
putback function
Places previous character extracted by the get function from an input stream back to that stream Syntax: istreamVar.putback (ch);
peek function
Returns next character from the input stream Does not remove the character from that stream Syntax: ch = istreamVar.peek ( );
Digit separator
Single quote can be used to separate digits of a number (can't use commas). Ex; 87'523
conditional
The ____ operator written as ?: is a ternary operator
setw
The _____ manipulator controls the output of only the next expression. Outputs value in a specified number of columns. Uses iomanip.
Two
The extraction operant takes ____ operands.
ifstream
The fstream header file contains the definitions of two data types: _____ and ofstream.
Compiler
What reports syntax errors?
Int or bool
What variables can you use to store value of logical expression
0
When using a return statement, the return of a value other than ____ indicates something went wrong
unsetf
You can disable a manipulator by using the stream function ____________________.
#define NDEBUG
You can disable assert statements by using the preprocessor directive ____.
main
_____ executes when a program is called. Other functions only execute when called.
function call
a command that executes the code within a function. Ex: pow (2, 3)
Input stream
a sequence of characters from an input device to the computer
Extraction operator >>
binary, used with cin, left side operant is an input stream, right side operant is a variable. Skips white space when scanning. cin >> variable
What are some of the reserved words in C ++
break, case, default NOT SELECT
left manipulator
causes subsequent output to be left justified
cin
common input
Manipulators without parameters requiring iostream
endl, fixed, scientific, showpoint, left
ostream
output stream. Found in iostream header file.
fixed manipulator
outputs floating-point numbers in a fixed decimal format
short circuit evaluation
process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.
getline function
reads characters entered at the keyboard until it encounters the delimiter character.
clear function
restores the input stream to a working state Syntax: istreamVar.clear ( );
Parameterized stream manipulators requiring iomanip
setprecision, setw, setfill