We have seen how the double
arrows (<<) of the cout
show that the information is going "out" to the monitor. In a similar
way, the double arrows (>>) of the
see-in) show characters flowing "into" the
program. The arrows point the way.
When using cin, it is
always necessary to provide a variable to the right of the operator to receive the input.
// sample program for cin
cout << "How many fleas does your cat have?";
cin >> fleas;
cout << "Well, that's " << fleas << " fleas too many!! \n\n\n";
can accept more than one variable as follows:
cout << "Enter an integer and a decimal:";
cin >> integer >> decimal;
You would enter the values by typing on a single line and leaving a space between them, or by typing them on separate lines and hitting ENTER after each entry.