I/O: sequence of bytes (stream of
bytes)
from source to destination
Bytes
are usually characters, unless program requires other types of information
Stream: sequence of characters from
source to
destination
Input
stream: sequence of characters
from an input
device to the computer
Output
stream: sequence of
characters
from the
computer to an output
device
•Use iostream header file to
extract (receive) data
from keyboard
and send output to the screen
−Contains
definitions of two data
types:
•istream -
input stream
•ostream -
output stream
−Has
two variables:
•cin -
stands for common input
•cout -
stands for common output
•To use cin and cout, the
preprocessor directive
#include
<iostream>
must
be used
•Variable declaration is
similar to:
−istream cin;
−ostream cout;
•Input
stream variables:
type
istream
•Output
stream variables:
type ostream
ليست هناك تعليقات:
إرسال تعليق