How to put a new line inside a string in C++?

Viewed 48252

I was thinking if it is possible to make a string in C++ which contains data in it like, I don't want to make a string of strings or an array of strings.

Suppose I have a string mv:

mv =  
"hello         
 new                   
 world "

"hello", "new" and "world" are in different lines. Now if we print mv, then "hello", "new" and "world" should come on different lines.

I was also thinking with respect to competitive programming. If I concatenate all the answers of queries in a single string and then output the answer, or cout all the queries one by one, will there be a time difference in both the outputs?

3 Answers
Related