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

C++中获取一个原生数据类型能表示的最大值

2017-01-14 12:02 381 查看
#include <limits>
#include <iostream>
using namespace std;
int main( )
{
int max_int = numeric_limits< int >::max( );
cout << "int: " << sizeof( int );
cout << ", " << max_int << endl;

long max_long = numeric_limits< long >::max( );
cout << "long: " << sizeof( long );
cout << ", " <<  max_long << endl;

float max_float = numeric_limits< float >::max( );
cout << "float: " << sizeof( float );
cout << ", " << max_float << endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  C++
相关文章推荐