#include <iostream>
using namespace std;
//使用C++的sizeof运算符计算int、float、double、char变量占用的空间大小
int main()
{
cout << "char: " << sizeof(char) << " 字节" << endl;
cout << "int: " << sizeof(int) << " 字节" << endl;
cout << "float: " << sizeof(float) << " 字节" << endl;
cout << "double: " << sizeof(double) << " 字节" << endl;
system("pause");
return 0;
}