Hello, sorry if it was asked before, but I tryed everything and it didn't work.
No new line inserted, the whole line in a row is dislayed instead.
The string must be passed as a const char * parameter to a function.
I intended: string s = "hello \n word!"
SO: Ubuntu 12.04
gcc versiĆ³n 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
You did not show your code so it is not clear what is the problem. If to consider the code from your previous message then it is simply to do what you want
1 2 3 4 5
string s = "Hello world";
s += '\n';
s += "here we go";
cout << s << endl;
And it would be more simply to initialize the string with the complete phrase
1 2 3
string s = "Hello world\nhere we go";
cout << s << endl;