c 換行符號有哪些
\n 換行,遊標移到下一行的開頭;
endl,把緩衝槽的內容輸出到控制台;
\r 回車,遊標移到目前行的開頭,不會換到下一行,如果接著輸出的話,本行以前的內容會被逐一覆蓋;
#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中文網其他相關文章!