+ 1
Is there any advantage of multiple insertion operators after cout over single insertion operators after cout.
3 Respostas
+ 2
Code readability. Also, there is a bit less to type.
I personally prefer this:
int a = 42;
cout << "The answer is " << a << "!" << endl;
...over this:
int a = 42;
cout << "The answer is "
cout << a
cout << "!"
cout << endl;
+ 2
Because I want to print the value of the variable a instead of the character a, obviously.
+ 1
Why dont you prefer this ?
cout << "This answer is a !" << endl;
I am asking