Home > Back-end >  Why not run up?
Why not run up?

Time:10-07

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_s

Line 16 printf (" \ "please input your guess number: % d " ", n); Didn't initialize, n, can't write

CodePudding user response:

refer to the second floor ipanda_huanhuan response:
10 lines of the scanf to change scanf_s

Line 16 printf (" \ "please input your guess number: % d " ", n); Didn't initialize, n, can't write

Why do n't initialization?

CodePudding user response:

reference qq_46533882 reply: 3/f
Quote: refer to the second floor ipanda_huanhuan response:
10 lines of the scanf to change scanf_s

Line 16 printf (" \ "please input your guess number: % d " ", n); Didn't initialize, n, can't write

Why do n't initialization?

That should be how to write???

CodePudding user response:

To printf (" \ "please input your guess number:" ");
The next line scanf_s (" % d ", & amp; N); Read the value of n

CodePudding user response:

Oh, thank you, ok

CodePudding user response:

reference 5 floor ipanda_huanhuan reply:
to printf (" \ "please input your guess number:" ");
The next line scanf_s (" % d ", & amp; N); Read the value of n

Thank you, can the

CodePudding user response:

Nothing nothing running through
  • Related