CodePudding user response:
#include#include
#include
Int main ()
{int x, m, I, n.
Srand (time (NULL));
Printf (" * * * * * * * number guessing game * * * * * * * \ n ");
Printf (" 1. The primary (guess the number 0) \ n2 intermediate (guess the number 0,1,2,3,4) \ n3 senior (guess the number 0,1,2,3,4,5,6) \ n ");
The scanf (" % d ", & amp; M);
If (m==1) printf (" guess the number 0 \ n ");
If (m==2) printf (" guess the number 0,1,2,3,4 \ n ");
If (m==3) printf (" guess the number 0,1,2,3,4,5,6 \ n ");
X=rand () % (2 * m + 1);
for(i=1; i<=3; I++)
{printf (" \ "please input your guess number: % d " ", n);
Scanf_s (" % d ", & amp; N);
If (n==x)
{
Printf (" \ "you are great! \ ""); break;
}
Else if (3 - I!=0)
{
Printf (" \ "guess wrong, you have opportunity " "% d times, 3 - I);
}
The else
{printf (" \ "Game Over, " "); break; }
}
} to write the code, why don't run out?
CodePudding user response:
10 lines of the scanf to change scanf_sLine 16 printf (" \ "please input your guess number: % d " ", n); Didn't initialize, n, can't write
CodePudding user response: