[C Language] Guess digital games
# Include <stdio. h> # include <stdlib. h> # include <time. h> void game () {int input = 0; printf ("welcome to the number game \ n"); srand (unsigned int) time (NULL )); int ret = rand () % 100; do {printf ("Enter the number you guessed:>"); scanf_s ("% d", & input ); if (input> ret) {printf ("You guessed too big \ n");} else if (input <ret) {printf ("You guessed too small \ n");} else {printf ("Congratulations, you guessed it \ n"); break ;}} while (1 );} void menu () {printf ("************************* \ n "); printf ("**** 1. start the game ******** \ n "); printf (" ***** 0. quit the game ******** \ n "); printf ("************************* \ n");} int main () {int choice = 1; while (choice) {menu (); printf ("select:>"); scanf_s ("% d", & choice); switch (choice) {case 1: game (); break; default: break;} system ("pause"); return 0 ;}