Home > Back-end >  Please ask bosses, program does not have an error no output
Please ask bosses, program does not have an error no output

Time:12-27

Please ask bosses, program does not have an error no output,
#include
#include
using namespace std;
Int main ()
{
Int n, a, b, c, m, n;
Float the I;
cin> n;
M=101;
N=0;
If (n>=m)
{
While (n & gt;=m)
{
I=SQRT (m);
A=m/100;
B=(m - 100 * a)/10;
C=a - m - 100 * 10 * b;
If (I==(int) I & amp; & (a==b | | b==c | | a==c))
N=N + 1;
The else
N=N;
}
cout <"Exist among this special number should have" & lt; cout }
The else
cout <"You n is too small;"
return 0;
}

CodePudding user response:

First of all, the cycle is an infinite loop,
Second, I==(int) that don't pay attention to the expression of I don't write,

Can consider to the square of the integer cycle it is fall within the specified range, it will cycle less number,

CodePudding user response:

Modified as follows, for your reference:
 # include 
#include
Int main (int arg c, char * argv [])
{
Int n, a, b, c, m, n;
Float the I;
cin> n;
M=101;
N=0;
If (n>=m)
{
While (n & gt;=m)
{
I=SQRT (n);//I=SQRT (m);
A=n/100;//a=m/100;
B=(n - 100 * a)/10;//b=(m - 100 * a)/10;
C=a - n - 100 * 10 * b;//c=a - m - 100 * 10 * b;
If (I==(int) I & amp; & (a==b | | b==c | | a==c))
N=N + 1;
The else
N=N;
n--;
}
cout <"Exist among this special number should have" & lt; //cout & lt; }
The else
cout <"You n is too small;"

return 0;
}
  • Related