-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path#limits.cpp
36 lines (32 loc) · 846 Bytes
/
#limits.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <limits>
#include <iomanip>
#include <cmath>
using namespace std;
template<typename T>
void showMinMax() {
cout << std::fixed;
cout << "min: " << numeric_limits<T>::min() << endl;
cout << "max: " << numeric_limits<T>::max() << endl;
cout << endl;
}
int main() {
cout << "short:" << endl;
showMinMax<short>();
cout << "int:" << endl;
showMinMax<int>();
cout << "long:" << endl;
showMinMax<long>();
cout << "float:" << endl;
showMinMax<float>();
cout << "double:" << endl;
showMinMax<double>();
cout << "long double:" << endl;
showMinMax<long double>();
cout << "unsigned short:" << endl;
showMinMax<unsigned short>();
cout << "unsigned int:" << endl;
showMinMax<unsigned int>();
cout << "unsigned long:" << endl;
showMinMax<unsigned long>();
}