For help in c + + to make up a program to find the computer machine precision and overflow and underflow value value
CodePudding user response:
# include & lt; Iostream>
#include
#include
using namespace std;
Int main ()
{
Cout & lt; Cout & lt; return 0;
}
Still should have long double,
CodePudding user response:
C/C + + types int, long, double, char said range (maximum minimum)
Copy the code
1 # include
2 # include
3 # include & lt; Limits>
4 using namespace STD.
5
6 int main ()
7 {
8 cout & lt; <"Type: t \ \ t" & lt; <"* * * * * * * * * * * * the size * * * * * * * * * * * * * *" & lt; 9 cout & lt; <"Bool: t \ \ t" & lt; <"The number of bytes:" & lt; 10 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Bool> : : Max ());
11 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Bool> : : min) () & lt; 12 cout & lt; <"Char: t \ \ t" & lt; <"The number of bytes:" & lt; 13 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Char> : : Max ());
14 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Char> : : min) () & lt; 15 cout & lt; <"Signed char: \ t" & lt; <"The number of bytes:" & lt; 16 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Signed char> : : Max ());
17 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Signed char> : : min) () & lt; 18 cout & lt; 19 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned char> : : Max ());
20 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Unsigned char> : : min) () & lt; 21 cout & lt; 22 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Would be & gt; : : Max ());
23 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Would be & gt; : : min) () & lt; 24 cout & lt; <"Short: t \ \ t" & lt; <"The number of bytes:" & lt; 25 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Short> : : Max ());
26 cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Short> : : min) () & lt; 27 cout & lt; <"Int: t \ \ t" & lt; <"The number of bytes:" & lt; 28 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Int> : : Max ());
29 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Int> : : min) () & lt; 30 cout & lt; <"Unsigned: \ t" & lt; <"The number of bytes:" & lt; 31 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned> : : Max ());
32 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Unsigned> : : min) () & lt; 33 cout & lt; <"Long: t \ \ t" & lt; <"The number of bytes:" & lt; 34 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Long> : : Max ());
35 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Long> : : min) () & lt; 36 cout & lt; <"Unsigned long" \ t "& lt; <"The number of bytes:" & lt; 37 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned long> : : Max ());
38 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Unsigned long> : : min) () & lt; 39 cout & lt; 40 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Double> : : Max ());
41 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Double> : : min) () & lt; 42 cout & lt; <"Long double: \ t" & lt; <"The number of bytes:" & lt; 43 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Long double> : : Max ());
44 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Long double> : : min) () & lt; 45 cout & lt; <"Float: t \ \ t" & lt; <"The number of bytes:" & lt; 46 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Float> : : Max ());
47 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Float> : : min) () & lt; 48 cout & lt; 49 cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Size_t & gt; : : Max ());
50 cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Size_t & gt; : : min) () & lt; 51 cout & lt; 52//& lt; <"\ t Max:" & lt; <(numeric_limits & lt; String> : : Max) is () & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; String> : : min) () & lt; 53 cout & lt; <"Type: t \ \ t" & lt; <"* * * * * * * * * * * * the size * * * * * * * * * * * * * *" & lt; 54 return 0;
55}
Copy the code
/* run results analysis:
These results have very understand, once added:
Concept of integer: integer, character, and Boolean value arithmetic types as integer (integral type),
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull