Why would you? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why would you?

why would you type cout <<"this"<<"is"<<"awesome!"; over just typing it like this cout <<"this is awesome!";

15th Jul 2018, 1:28 PM
Nathan Maguire (GoodNate)
Nathan Maguire (GoodNate) - avatar
2 Answers
+ 4
Nathan Maguire (GoodNate) The first is only useful ,when you want to inject the value of a variable into the statement Example ======== int age = 17; cout << "I am "<<age << " years old ". If you aren't using the value of a variable in such statements, then just saying cout <<"This "<<"is "<<"awesome"; Would be a waste of time and effort
15th Jul 2018, 1:42 PM
Dlite
Dlite - avatar
+ 1
I wouldn't
15th Jul 2018, 1:37 PM
ReimarPB
ReimarPB - avatar