- int main()
- 注释
//更优
/**/ - 输入cin输出cout
include <iostream>
using namespace std;//名称空间编译指令 using编译指令
count<<endl;
5. 名称空间
std::cout<<std:endl;
using std:cout;//make cout available
using std:endl;//make endl available
6. 1. cout和cin
cout<<"Come up.";
cin>>carrots;//临时变量
cout<<carrots<<endl;
>>插入运算符,插入到输出流中,表示该语句将把这个字符串发送给cout;该符号指出了信息流动的路径。
cout:输出字符串、数字和单个字符等。
cin: 读取键盘输入。
6.2 endl :重起一行
6.3 \n 换行符
一个区别:endl确保程序继续运行前刷新输出(将其立即显示在屏幕上),而\n不能提供这种保障,意味着可能在输入信息后才会出现提示。
7. 自定义函数
int simon(int); //function prototype for simon()
int main(){}
int simon(int n){}