SLIDE 3 I/O Flashcards
sequence of bytes (stream of bytes) from source to destination
Input/Output
sequence of characters from the source to the destination
Stream
sequence of characters from an input device to the computer
Input stream
sequence of characters from the computer to an output device
Output stream
Use ________ header file to receive data from keyboard and send output to the screen
iostream
iostream contains definitions of two data types:
istream: input stream
ostream: output stream
iostream has two variables:
cin: stands for common input
cout: stands for common output
Variable declaration of istream and ostream is similar to:
istream cin;
ostream cout;
To use cin and cout, the preprocessor directive _________ must be used
include <iostream></iostream>
Input stream variables: type _____
istream
Output stream variables: type _______
ostream
The syntax of an input statement using cin and the extraction operator»_space; is
cin»_space; variable»_space; variable…;
The extraction operator»_space; is _____
binary
Left-side operand is an _________
Example: cin
Right-side operand is a __________
input stream variable
variable
Entering a char value into an int or double variable causes serious errors, called
input failure
skips leading whitespace, finds and stores only the next character
char variable
skips leading whitespace, reads + or - sign (if any), reads the digits (including decimal for floating-point variables)
int or double variable
executes when a program is run
main
(subprogram) is a set of instructions
function
Predefined functions are organized as a collection of libraries called
header file
Inputs next character (including whitespace)
Stores in memory location indicated by its argument
get function
The syntax of cin and the get function
cin.get (varChar);
is a char variable
It is the argument (or parameter) of the function
varChar
ignore function
Discards a portion of the input
The syntax to use the function ignore is:
cin.ignore (intExp, chExp);
intExp is an ______expression
chExp is a _______expression
integer
char
Places previous character extracted by the get function from an input stream back to that stream
putback function
Returns next character from the input stream
Does not remove the character from that stream
peek function