#include <stdio.h> #include <time.h> #include <stdlib.h>int main () { while (1) { int start; printf ("Please select \ n"); printf ("1 game start \ n"); printf ("0 Game over \ n"); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;SCANF ("%d",& Start); switch (start) { case 1: { int radom; srand (Time (NULL)); radom=rand ()%100; while (1) { int m; printf ("Please enter the number you want to guess \ \"); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;SCANF ("%d", &m); if (m==radom) { printf ("Congratulations, you guessed it!") \ n "); break; } else if (m>radom) printf ("Guess big \"); else printf ("Guess small \ n"); } break; } case 0: return 0; default: printf ("Input error, please re-enter \ n"); }&nbsP;} return 0;} RAND ()//Gets the random number function Srand (Time (NULL)); rand (); //random number based on temporal change
Guess number Game