cout<<“hello world”<<endl;
等同于
cout<<“hello world\n”;
cout<<flush;
endl相当于输出回车后,再强迫缓冲输出。
flush强迫缓冲输出
printf是无缓冲输出,有输出立即输出
cout<<“hello world”<<endl;
等同于
cout<<“hello world\n”;
cout<<flush;
endl相当于输出回车后,再强迫缓冲输出。
flush强迫缓冲输出
printf是无缓冲输出,有输出立即输出