Input and Output Functions
Apart from 'cin' and 'cout', there are many other functions we can use to perform input/output operations.
We'll cover the following...
Input
In C++ we can read from the input stream in two different ways: Formatted with the extractor >> and unformatted with explicit methods.
Formatted input
The extraction operator >>:
- is predefined for all built-in types and strings.
- can be implemented for user-defined data types.
- can be configured by format specifiers.
...🔑
std::cinignores, by default, leading whitespace#include <iostream> //... int a, b; std::cout << "Two natural numbers:
Ask