7个回答
2015-06-29
展开全部
1 2 3 4 5 6 7 8 9 10 11 12 | #include<stdio.h> int main() { printf ( "sizeof(int)=%d\n" , sizeof ( int )); printf ( "sizeof(float)=%d\n" , sizeof ( float )); printf ( "sizeof(double)=%d\n" , sizeof ( double )); printf ( "sizeof(char)=%d\n" , sizeof ( char )); //依次为 4 4 8 1 return 1; } |
本回答被网友采纳
展开全部
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include<iostream> using namespace std; int main() { int a; float b; double c; cout<< sizeof (a)<<endl; cout<< sizeof (b)<<endl; cout<< sizeof (c)<<endl; system ( "pause" ); return 0; } |
一般int类型都是4字节
展开全部
1 2 3 4 5 6 7 8 9 10 11 | #include <iostream> using namespace std; int main() { cout<< "int 长度" << sizeof ( int ) <<endl << "float 长度" << sizeof ( float ) <<endl << "double 长度" << sizeof ( double )<<endl; retrn 0; } |
展开全部
1 2 3 4 5 6 7 8 9 10 11 | #include<iostream> using namespace std; int main(){ int s1= sizeof ( int ); int s2= sizeof ( float ); int s3= sizeof ( double ); cout<< "int:" <<s1<< "字节\n" ; cout<< "float:" <<s2<< "字节\n" ; cout<< "double:" <<s3<< "字节\n" ; return 0; } |
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询