Sunday, October 12, 2008

numeric_limits

#include <iostream>
#include <limits>

using namespace std;
int main() {

cout << "max(short): " << numeric_limits<short>::max() << endl;
cout << "max(int): " << numeric_limits<int>::max() << endl;
cout << "max(long long): " << numeric_limits<long long>::max() << endl;
cout << "max(unsigned long long): " << numeric_limits<unsigned long long>::max() << endl;

cout << "max(double): " << numeric_limits<double>::max() << endl;

return 0;
}
output:

max(short): 32767
max(int):   2147483647
max(long long):  9223372036854775807
max(unsigned long long):  18446744073709551615
max(double):  1.79769e+308