C++ 实例 - 输出换行

3572 1
LZH实名认证 2022-3-17 20:11:23 | 显示全部楼层 |阅读模式
使用 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
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行