Input
- We have already briefly looked at the stream extraction operator, or get from (>>)
- What is the behavior for char? string?
- Some other character/string input functions
- getline(stream, string)
- getline(cin,aStringVar)
- getline consumes, but does not store the new line character.
- stream.get(chartype)
- cin.get(aChar)
- stream.ignore(lenght, character)
- Newline character is '\n'
- cin.ignore(80,'\n');
- cin >> instring; will not consume any white space following the word input, even a new line character.
- integer input
- Whitespace characters are ignored
- If a non digit is encountered (or +/-) then the stream goes into error
- reads optional (+/-)
- Reads digits until a non digit is encountered.
- The nondigit is not consumed
- Floating point is much the same, but it can read the entire
set of optional floating point numbers.
- Trace some input.