previous
|
start
|
next
Input and Output
>>
operator reads console input:
cin >> pennies;
If user doesn't enter appropriate input, then the stream fails. All subsequent input also fails.
Can read multiple values:
cin >> pennies >> nickels >> dimes >> quarters;
User enters input separated by spaces or newlines, e.g.
8 0 4 3
or
8 0 4 3
Input is
buffered
. If you type two inputs on one line, the second one is saved for the next input statement.
previous
|
start
|
next