输出:cout
#includeusing namespace std; int main() { cout << "helloworld" << endl; system("pause"); return 0; }
注释:
单行注释://
多行注释:/…/
变量:
作用:给一段指定的内存空间起名,方便操作
**常量:**不可更改的数据
定义方式:
1.#define 常量名 常量值
通常在文件上方定义,表示一个常量
2.const 数据类型 常量名 =常量值
#includeusing namespace std; #define day 30 //1.单行注释 int main() { const int week = 7; int a = 10; cout << "a=" < 命名规则:
1.不可以是关键字
2.名字只能由字母数字下划线组成
3.开头必须是字母或者下划线
4.区分大小写
sizeof:统计数据类型所占内存大小
用法:sizeof(数据类型/变量)#includeusing namespace std; int main() { cout << "int所占的字节大小为" << sizeof(int) << endl; system("pause"); return 0; } 实型(浮点型数据)
1.float
2.double
科学记数法:float num=3e2;//3*10^2字符型:



