1.endl
功能說明:endl的功能類似于換行符\n
。特別需要說明的是着降,在CLion中調(diào)試代碼時(shí)差油,若在一條語句的末尾,如cout << "hello world!" ;
任洞,加上\n
或者<< endl
,則單步調(diào)試完該行代碼蓄喇,就會(huì)在終端輸出相應(yīng)的語句,否則不會(huì)輸出交掏。
用法:使用endl
,必須要在代碼文件開頭添加using namespace std;
示例:
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
int a = 123;
cout << "百二秦關(guān)終屬楚,三千越甲可吞吳.\n";
cout << "永歲飄零,殢無傷!";
return 0;
}