I have the following code:
#include <iostream>
using namepsace std;
int main() {
cout << "Hello\nworld!" << endl;
}
On console it prints:
Hello
world!
But why world! starts from the beginning of a line wihout '\r' character?
I have the following code:
#include <iostream>
using namepsace std;
int main() {
cout << "Hello\nworld!" << endl;
}
On console it prints:
Hello
world!
But why world! starts from the beginning of a line wihout '\r' character?
While strictly speaking \n
is newline and \r
is carriage return, it's up to the particular console how these are interpreted. It seems your console (like most) does a carriage return on a newline.