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;
}
#include <iostream>
using namespace std;
int main() {
cout << "Runoob \n";
cout << "Google \n";
cout << "Taobao";
return 0;
}
#include <iostream>
using namespace std;
int main() {
cout << "Runoob" << endl;
cout << "Google" << endl;
cout << "Taobao";
return 0;
}
以上程序执行输出结果为:
Runoob
Google
Taobao