TUTORIAL编程语言与算法FETCHED

C++ 实例 - 输出换行

C++ 实例 - 输出换行 C++ 实例 使用 C++ 输出,并对多个输出内容进行换行,使用 \n 或 endl: 实例 - \n 换行[mycode3 type='js'] #include using namespace std; int main() { cout..

更新于 2026/7/16

教程详情页默认 noindex。

C++ 实例 - 输出换行

C++ 实例 C++ 实例

使用 C++ 输出,并对多个输出内容进行换行,使用 \n 或 endl:

实例 - \n 换行

#include <iostream> using namespace std; int main() { cout << "Runoob \n"; cout << "Google \n"; cout << "Taobao"; return 0; }

实例 - endl 换行

#include <iostream> using namespace std; int main() { cout << "Runoob" << endl; cout << "Google" << endl; cout << "Taobao"; return 0; }

以上程序执行输出结果为:

Runoob 
Google 
Taobao

C++ 实例 C++ 实例