您的位置:首页 > 编程语言 > C语言/C++

第二个C++程序,认识各种数据格式

2013-09-21 20:07 232 查看
#include<iostream>
#include<climits>
int main()
{
using namespace std;
int n_int=INT_MAX;
short n_short=SHRT_MAX;
long n_long=LONG_MAX;
long long n_llong=LLONG_MAX;

cout <<"int is "<<sizeof(int)<<"bytes."<<endl;
cout <<"short is "<<sizeof n_short<<"bytes."<<endl;
cout <<"long is "<<sizeof n_long<<"bytes."<<endl;
cout <<"long long is "<<sizeof n_llong<<"bytes."<<endl<<endl;

cout<<"Maximum values:"<<endl;
cout<<"int:"<<n_int<<endl;
cout<<"short: "<<n_short<<endl;
cout<<"long: "<<n_long<<endl;
cout<<"long long: "<<n_llong<<endl<<endl;

cout<<"Minimum int value="<<INT_MIN<<endl;
cout<<"Bits per byte= "<<CHAR_BIT<<endl;
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: