C-language puzzle game 1
Include <stdio. h> # include <stdlib. h> # include <time. h> void print_menu () {printf ("************************* \ n "); printf ("********* 1. start ****** \ n "); printf (" ********* 0. exit ****** \ n "); printf ("*********************** \ n");} int main () {int input = 1; printf ("welcome to the guess number GAME \ n"); while (input) {print_menu (); printf ("SELECT> "); scanf ("% d", & input); switch (input) {case 1: {int n = 0; int ch = 0; srand (unsigned int) time (NULL); n = rand () % 101; while (1) {printf ("Please guess a (0-100) direct number \ n "); scanf ("% d", & ch); if (ch> n) {printf ("You guessed \ n");} else if (ch <n) {printf ("You guessed it \ n");} else {printf ("Congratulations, you guessed it \ n"); break ;}} break;} default: printf ("game logout \ n"); break ;}} system ("pause"); return 0 ;}