ホームページ  >  記事  >  バックエンド開発  >  C++の改行とは何ですか?

C++の改行とは何ですか?

angryTom
angryTomオリジナル
2019-11-04 15:22:5017269ブラウズ

C++の改行とは何ですか?

#c 改行とは何ですか

\n 改行、カーソルが移動します次の行の先頭へ 次の行が出力されると、この行の前の内容が 1 つずつ上書きされます;

#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;  
}

結果:

this is the first line
this is the third linee
this is the fifth line
First
Second
Second23
这是换
行符
Presss any key to continue
推奨コース: C言語チュートリアル

以上がC++の改行とは何ですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。