+ 2

Instead of using multiple insertion operators,we can use only one operator right??? It will minimise the code right????

19th Jul 2018, 9:21 AM
Rikshith U Uchil
Rikshith U Uchil - avatar
7 Réponses
+ 3
"Instead of using multiple insertion operators,we can use only one operator right???" One << operator for every commit to the output stream. But if you are talking about the "cout" global object (as your question tag refers to), it's a matter of style and good practices. For example, it's best to associate all related pieces of the output to one cout as int x = 20; cout << "Who knows what's going to happen to programming world " << x << " years from now. But, almost all analysts have reached " << "to a general consensus on the matter of improved productivity." << endl; Or cout << "Who knows what's going to happen to programming world " "20 years from now. But, almost all analysts have reached " "to a general consensus on the matter of improved productivity.\n"; Versus, the unrelated facts and data as cout << "function 1's return value is : " << f1() << endl; cout << "function 2's return value is : " << f2() << endl;
19th Jul 2018, 9:48 AM
Babak
Babak - avatar
0
Make sense. But i don't think it will make the code easier.
19th Jul 2018, 9:47 AM
LAWArthur
0
You are talking about C++?
19th Jul 2018, 9:48 AM
Yuri Biasi
Yuri Biasi - avatar
0
I’m new to C, but this allows you to insert variables into your text stream
26th Jul 2018, 4:50 PM
David Howard
David Howard - avatar
0
yes
30th Jul 2018, 8:06 PM
Hot Gamer Studio
Hot Gamer Studio - avatar
0
cout<<"Hello"
30th Jul 2018, 8:07 PM
Hot Gamer Studio
Hot Gamer Studio - avatar
0
return (0)
30th Jul 2018, 8:07 PM
Hot Gamer Studio
Hot Gamer Studio - avatar