1 C++的话,用编译器定义的,基本类型都有;
 2 #include <iostream>
 3 #include <limits>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9  int intMax = numeric_limits<int>::max();
10  int intMin = numeric_limits<int>::min();
11 
12  float floatMax = numeric_limits<float>::max();
13  float floatMin = numeric_limits<float>::min();
14 
15  cout << intMax << " " << intMin << endl;
16  cout << floatMax << " " << floatMin << endl;
17 
18   return 0;
19 }

参考资料:

http://zhidao.baidu.com/link?url=qDaG0J4L2VcHy8BILYwQEwWvjqQ0035C4UO1vnjs-N1IxYAMSsuErHcLSBikyohthLECb0UGDn14nTHkYABmG_

posted on 2014-03-02 14:27  mobileliker  阅读(252)  评论(0编辑  收藏  举报