1.头文件 #include <iostream> 其他头文件去掉.h直接在开头加c
例:#include <string.h>-------> #include <cstring>
2.using namespace std; 使用std名称空间,避免函数重复
3.输入 cin >> n; 等价于scanf("%d".&n);
4.输出 cout << "Hello " << ++n << endl;(输出多个不同的东西) endl等价于 "\n"(换行)
5.变量定义:在for循环里可直接定义 for(int i = 0;i < 10;++i)
6.bool变量:非0为true,0为false
7.const修饰:用const定义的常量不能被改变(类似宏定义)
8.string类:定义字符串:string s = "hello"; string s1 = "world";
字符串拼接:string s2 = s + s1;
输入(出):cin >> s;(只能输入一个单词) getline(cin,s);(输入一行)
cout << s << endl;
9.结构体:在定义后,命名结构体时可以省去struct(不用typedef)

10.引用&:可以通过传参改变原函数里的一些数值(作用类似指针)