用c++编写一个程序,输出基本数据类型char, short, int, long, float,

2024-11-08 06:13:18
有2个网友回答
网友(1):

#include

using namespace std;
int main()
{
cout<<<<return 0;
}是这个意思吗

网友(2):


#include "stdio.h"int main()

{    

printf("char有%d字节\n",sizeof(char));   

printf("short有%d字节\n",sizeof(short));    

printf("int有%d字节\n",sizeof(int));    

printf("long有%d字节\n",sizeof(long));    

printf("long long有%d字节\n",sizeof(_int64));    

printf("float有%d字节\n",sizeof(float));    

printf("double有%d字节\n",sizeof(double));    

printf("long double有%d字节\n",sizeof(long double));    

return 0;

}