Sun Studio 12: C++ User's Guide

14.3.2 Input Using iostream

Input using iostream is similar to output. You use the extraction operator >> and you can string together extractions the way you can with insertions. For example:


cin >> a >> b;

This statement gets two values from standard input. As with other overloaded operators, the extractors used depend on the types of a and b (and two different extractors are used if a and b have different types). The format of input and how you can control it is discussed in some detail in the ios(3CC4) man page. In general, leading whitespace characters (spaces, newlines, tabs, form-feeds, and so on) are ignored.