13.4. Stream Input
Now let’s consider stream input. Formatted and unformatted input capabilities are provided by
istream. The stream extraction operator (
>>) normally skips white-space characters (such as blanks, tabs and newlines) in the input stream; later we’ll see how to change this behavior. After each input, the stream extraction operator returns a reference to the stream object that received the extraction message (e.g.,
cin in the expression
cin >> grade). If that reference is used as a condition (e.g., in a
while statement’s loop-continuation condition), the stream’s overloaded
void * cast operator function is implicitly invoked to convert the reference into a non-null pointer value or the null pointer based on the success or failure, ...