#include<iostream>
using namespace std;
int main()
{
cout<<"int資料長度="<<sizeof(int)<<"bytes"<<endl;
cout<<"float資料長度="<<sizeof(float)<<"bytes"<<endl;
cout<<"char資料長度="<<sizeof(char)<<"bytes"<<endl;
cout<<"long資料長度="<<sizeof(long)<<"bytes"<<endl;
cout<<"5.3+2.6資料長度="<<sizeof(5.3+2.6)<<"bytes"<<endl;
system("pause");
return 0;
}
結果輸出:
int資料長度=4bytes
float資料長度=4bytes
char資料長度=1bytes
long資料長度=4bytes
5.3+2.6資料長度=8bytes
請按任意鍵繼續 . . .
全站熱搜