Home > Back-end >  20200510 - VS Code problem (numeric_limits <char> : : min) () cannot be used
20200510 - VS Code problem (numeric_limits <char> : : min) () cannot be used

Time:09-23

Question: (numeric_limits & lt; Char> : : min) () function cannot show subsequent text, such as

Source:
 # include & lt; Iostream> 
using namespace std;

//variable declaration
Extern int a, b;
Extern int c;
Extern float f;

Int main ()
{
//variable definition
int a, b;
Int c;
Float f;

//actual initialization
a=10;
B=20.
C=a + b;

Cout & lt;
F=70.0/3.0;
Cout & lt;
return 0;
}

Results:


Obviously wrong,
I commented out the code below can show the back of the results,
//cout & lt; <"Char: t \ \ t" & lt; <"The number of bytes:" & lt; //cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Char> : : Max ());//(numeric_limits & lt; Char> : : min) (the) can't use the 
//cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Char> : : min) () & lt; //cout & lt; <"Signed char: \ t" & lt; <"The number of bytes:" & lt; //cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Signed char> : : Max ());
//cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Signed char> : : min) () & lt; //cout & lt; //cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned char> : : Max ());
//cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Unsigned char> : : min) () & lt;
Find the & lt; Limits> Header file, inside of char function is defined, how is this to return a responsibility excuse me?

CodePudding user response:

Didn't understand what you ask??????
The first piece of code behind and what is the connection??????
Unsigned char biggest sure to print out,

CodePudding user response:

Bad, head dizzy, thanks to "the truth is right and wrong" reminds, code duplication is wrong, the first piece of code should be below code,
 # include 
# include & lt; Limits>

using namespace std;

Int main ()
{
Cout & lt; <"Type: t \ \ t" & lt; <"* * * * * * * * * * * * the size * * * * * * * * * * * * * *" & lt; Cout & lt; <"Bool: t \ \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Bool> : : Max ());
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Bool> : : min) () & lt; Cout & lt; <"Char: t \ \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Char> : : Max ());//(numeric_limits & lt; Char> : : min) (the) can't use the
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Char> : : min) () & lt; Cout & lt; <"Signed char: \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Signed char> : : Max ());
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Signed char> : : min) () & lt; Cout & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned char> : : Max ());
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Unsigned char> : : min) () & lt; Cout & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Would be & gt; : : Max ());
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Would be & gt; : : min) () & lt; Cout & lt; <"Short: t \ \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Short> : : Max ());
Cout & lt; <"T \ \ t the minimum:" & lt; <(numeric_limits & lt; Short> : : min) () & lt; Cout & lt; <"Int: t \ \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; int> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; int> : : min) () & lt; Cout & lt; <"Unsigned: \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Unsigned> : : min) () & lt; Cout & lt; <"Long: t \ \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Long> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Long> : : min) () & lt; Cout & lt; <"Unsigned long" \ t "& lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Unsigned long> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Unsigned long> : : min) () & lt; Cout & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Double> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Double> : : min) () & lt; Cout & lt; <"Long double: \ t" & lt; <"The number of bytes:" & lt; Cout & lt; <"\ t Max:" & lt; <(numeric_limits & lt; Long double> : : Max ());
Cout & lt; <"\ t the minimum:" & lt; <(numeric_limits & lt; Long double> : : min) () & lt; Cout & lt; <"Float: t \ \ t" & lt; <"The number of bytes:" & lt;
  • Related