std::cin














































std::cin



Once std::cin is constructed, std::cin.tie() returns &std::cout,and likewise, std::wcin::tie() returns &std:;wcout. This means that any formatted input operation on std::in forces a call to std::cout.flush() if any characters are pending for output.


for example:
#include<iostream>
struct f{
     int n;
     f(){
        std::cout<<"n:";//no flush needed
        srd::cin>>n;
     }
 };
f a;//static object
int main(){
       std::cout<<a.n<<endl;
 }
Output:
n:15
15



More Articles of More Rakesh:

Name Views Likes
std::dec 457 1
std::clog 723 1
std::scanf 539 0
std::fixed 3370 0
std::freopen 532 0
std::fclose 287 1
std::cerr and std::wcerr 764 0
Std:cout 400 1
std::fprintf() 580 0
std::setw and std::setfill 1148 0
std::defaultfloat 602 0
std::endl 245 0
std::cin 294 1
std::fread() 645 0
std::fopen() 615 1

Comments