整型
sizeof关键字
#include <iostream>
using namespace std;
int main() {
int a = 10;
cout << sizeof(a) << endl; //求变量a所占内存空间
return 0;
}
浮点型
字符型
转义字符
字符串
#include <iostream>
using namespace std;
#include <string> //使用c++风格需要这个,但是我没加clion没报错
int main() {
char fuck[] = "fuck";//c语言风格
string shit = "shit";//c++风格
cout << fuck << " " << shit << endl;
cout << fuck + shit << endl;
}
布尔类型
数据的输入
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
cout<<"a="<<a<<endl;
}