0

why dont you use endl; when printing strings?

string a = "whats up"; cout << a; return 0;

17th Jan 2017, 7:53 AM
jonathin
3 Respostas
+ 3
you can you do not with cin.. cout << "hi" << endl; // ok cin >> a << endl // not ok you example goes string a = "whats up"; cout << a << endl;
17th Jan 2017, 7:57 AM
jay
jay - avatar
+ 2
generally we can use but in your context I think when we use endl it remove everything in buffer which take some time..so, in order to be reduce time complexity we don't use.But using endl is good practice..
17th Jan 2017, 9:08 AM
Ayush Mishra
Ayush Mishra - avatar
0
Because it only prints one string and it's unneccessary (unless you use system("exit"); ).
17th Jan 2017, 8:02 AM
Norbivar
Norbivar - avatar