C++ Library Reference

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(3C++) man page. In general, leading whitespace characters (spaces, newlines, tabs, form-feeds, and so on) are ignored.