Input and Output Using Streams
- Input is an a sequence of characters coming into the program from an input device; the keyboard or a file
- Output is also a sequence of characters but going from the program to an output device; the display terminal or a file
- There are two declarations in iostream.h:
istream cin;
ostream cout;
- These are special streams for the standard devices; keyboard (cin) and display (cout)
- << is the insertion operator for cout; this operator can occur multiple times in one statement
- >> is the extraction operator for cin; also can occur multiple times in a single statement
int a;
cin >> a;
This causes the next input from the stream to be stored into the integer a
Next page
Previous page
Go to Lesson 4 index.