The
input operator, >>
, also known as the
extraction operator, is the complement of the output
operator.
When used with the cout
output-place specification, the
output operator displays the value of an expression on your screen.
When used with the cin
input-place specification, the
input operator picks up a value for a variable by watching what
you type on your keyboard. In the following program, for
example, each input expression picks up an integer and assigns
that integer to a variable:
#includemain ( ) { int height, width, length; cout << "Please type three integers." << endl; cin >> height; cin >> width; cin >> length; cout << "The volume of a " << height << " by " << width << " by " << length << " box car is " << height * width * length << endl; }