Guessing game.

_CRT_SECURE_NO_WARNINGS #define
#include <stdio.h>
#include <stdlib.h>
void Game () {
int NUM = 0;
// guessing game
. @ The system 1 generates a random number, random number 1-100
int = toGuess RAND () + 100%. 1;
. 2 // user to enter an integer
the while (. 1)
{
the printf ( "Please enter an integer (1-100):");
Scanf ( "% D", & NUM);
IF ( NUM <toGuess)
{
printf ( "low \ the n-");
}
the else IF (NUM> toGuess)
{
printf ( "engage in \ the n-");
}
the else
{
"! Congratulations, you guessed it \ n" printf () ;
BREAK;
}

}

}
int Menu()
{
printf("=\ the n-");
printf (" 1 to start the game \ the n-. ");
printf (" 0 to exit the game \ the n-. ");
printf ("
= \ n-");
the printf (" Enter your choice: ");
int Choice = 0;
Scanf ("% D ", & Choice);
return Choice;
}
int main ()
{
// Time

while (1)
{
	int choice = Menu();
	if (choice == 1)
	{
		Game();
	}
	else
	{
		printf("goodby!\n");
		break;
	}
}
return 0;

}
Here Insert Picture Description

Published 18 original articles · won praise 0 · Views 192

Guess you like

Origin blog.csdn.net/qq_42649916/article/details/104374270