Home > Article > Backend Development > What are the line breaks in c++?
c What are the line breaks
\n Line break, the cursor moves to the next line at the beginning of If the next line is output, the previous contents of this line will be overwritten one by one;
#include <iostream> using namespace std; int main() { cout << "this is the first line\n"; cout << "this is the second line\r"; cout << "this is the third line\n"; cout << "this is the fouth line\r"; cout << "this is the fifth line\n"; cout<<"First"<<"\n"<<"Second"<<endl; cout<<"First123"<<"\r"<<"Second"<<endl; cout<<"这是换"<<endl<<"行符"; return 0; }
Result: this is the first line
this is the third linee
this is the fifth line
First
Second
Second23
这是换
行符
Presss any key to continue
Recommended course:
The above is the detailed content of What are the line breaks in c++?. For more information, please follow other related articles on the PHP Chinese website!