why "" when inputing \n | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why "" when inputing \n

i was wondering why i need to put \n in "" and not just a plain break?

30th Jul 2017, 6:54 PM
Cayden Swanepoel
Cayden Swanepoel - avatar
1 Answer
+ 5
Because you are sending a newline character which must be processed as part of a string. *Note* you can also use endl for the same result. Example: std::cout << "Hello World" << endl << "This is on a new line"; This is the same as std::cout << "Hello World\nThis is on a new line";
30th Jul 2017, 7:08 PM
S C