-
Notifications
You must be signed in to change notification settings - Fork 15
/
ex.3.1.cpp
28 lines (23 loc) · 798 Bytes
/
ex.3.1.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
// ex.3.1
// en: Find the largest and smallest numbers that you can represent
// with types int, long int, short int, float, and double in your
// programming environment.
// ru: Найдите наибольшее и наименьшее числа, которые можно
// представить типами int, long int, short int, float, double в своей
// среде программирования.
#include <iostream>
#include <limits>
#include <typeinfo>
template <typename T>
void Limits() {
std::cout << typeid(T).name() << ' ' << std::numeric_limits<T>::min() << ' '
<< std::numeric_limits<T>::max() << '\n';
}
int main() {
Limits<int>();
Limits<long int>();
Limits<short int>();
Limits<float>();
Limits<double>();
return 0;
}