在 C++ 中,字符“\n”表示换行符,可通过以下方式使用:使用 cout << "\n" 即可换行。使用 endl 操纵符,既可换行又可刷新输出流。
C++ 中 \n 的用法
在 C++ 编程语言中,字符 '\n' 表示换行符。它用于将输出移动到下一行。
用法:
示例:
#include <iostream> using namespace std; int main() { cout << "Hello" << endl; cout << "World" << "\n"; return 0; }
输出:
<code>Hello World</code>
注意:
Das obige ist der detaillierte Inhalt vonVerwendung von \n in C++. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!