std::cin, std::wcin
Min standard notice:
Header: <iostream>
The global objects std::cin and std::wcin control input from a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C input stream stdin.
# Declarations
extern std::istream cin;
extern std::wistream wcin;
# Notes
The ‘c’ in the name refers to “character” (stroustrup.com FAQ); cin means “character input” and wcin means “wide character input”.
# Example
#include <iostream>
struct Foo
{
int n;
Foo()
{
std::cout << "Enter n: "; // no flush needed
std::cin >> n;
}
};
Foo f; // static object
int main()
{
std::cout << "f.n is " << f.n << '\n';
}