Home  >  Article  >  Backend Development  >  What are the line breaks in c++?

What are the line breaks in c++?

angryTom
angryTomOriginal
2019-11-04 15:22:5017303browse

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:

C language tutorial

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn