使用sizeof(数据名/变量名)统计各类型所占字节
#include <iostream>
using namespace std;
#include <string>
int main() {
//各类型在c++中所占字节
cout << "各类型在c++中所占字节" << endl;
cout << "sizeof(bool)=" << sizeof(bool) << "字节" << endl;
cout << "sizeof(char)=" << sizeof(char) << "字节" << endl;
cout << "sizeof(short)=" << sizeof(short) << "字节" << endl;
cout << "sizeof(int)=" << sizeof(int) << "字节" << endl;
cout << "sizeof(long)=" << sizeof(long) << "字节" << endl;
cout << "sizeof(long long)=" << sizeof(long long) << "字节" << endl;
cout << "sizeof(float)=" << sizeof(float) << "字节" << endl;
cout << "sizeof(double)&#