#include<iostream>
using namespace std;//使用标准库名字空间
int mai()//主函数
{int n;//说明用n表示整数
n=sizeof(short int);//计算类型大小,将所占字节数赋值给符号n
cout<<"short int"<<n<<endl;//输出2
n=sizeof(int);//整数
cout<<"int"<<n<<endl;//输出4
n=sizeof(long int);//长整型
cout<<"long int "<<n<<endl;//输出4
n=sizeof(char); //字符串
cout<<"char"<<n<<endl;//输出1
n=sizeof(bool);//逻辑型(布尔型)
cout<<"bool"<<n<<endl;//输出1
n=sizeof(float);//浮点型
cout<<"float "<<n<<endl; //输出4
n=sizeof(double);//双精度型
cout<<"double"<<n<<endl;//输出8
return 0;
}
这段代码哪里错
using namespace std;//使用标准库名字空间
int mai()//主函数
{int n;//说明用n表示整数
n=sizeof(short int);//计算类型大小,将所占字节数赋值给符号n
cout<<"short int"<<n<<endl;//输出2
n=sizeof(int);//整数
cout<<"int"<<n<<endl;//输出4
n=sizeof(long int);//长整型
cout<<"long int "<<n<<endl;//输出4
n=sizeof(char); //字符串
cout<<"char"<<n<<endl;//输出1
n=sizeof(bool);//逻辑型(布尔型)
cout<<"bool"<<n<<endl;//输出1
n=sizeof(float);//浮点型
cout<<"float "<<n<<endl; //输出4
n=sizeof(double);//双精度型
cout<<"double"<<n<<endl;//输出8
return 0;
}
这段代码哪里错