#include <stdio.h>
#include <stdlib.h>
int main ()
{
printf ("************ guessing game *************\n");
printf ("***********1: Start Game ***********\n");
printf ("***********2: Exit Game ***********\n");
printf ("***********3: Game Introduction ***********\n");
printf ("***********4: Help ***************\n");
int n=1;
while (n)
{
printf ("Please select");
scanf ("%d", &n);
Switch (n)
{
Case 1:
{
int num, m;
num = 0;
m = rand ()% 101;
printf ("Please guess a 1-100 of a number \ n");
while (1)
{
scanf ("%d", &num);
if (num > m)
printf ("Guess Big");
else if (num < m)
printf ("Guess small");
Else
{
printf ("Congratulations, guess right");
Break
}
}
}
Case 2:
{
Exit (0);
}
Case 3:
{
printf ("Through the computer prompts the size of the player to constantly modify the input number until the last and the same number, the game ends \ \");
printf ("The trick is to use binary find, each time to find the middle value, you can find the fastest, good luck, there is no need, hehe \ \");
Break
}
Case 4:
{
printf ("The game needs to be run under C compile software, the editor is written in the visual studio2013 version, if there is a problem, please contact the game author \ n");
Break
}
Default
{
printf ("Game exit");
Break
}
}
}
System ("pause");
return 0;
}
This article is from the "Qin-wang" blog, make sure to keep this source http://10810196.blog.51cto.com/10800196/1706180
Guessing games-don't know why you can't lose Chinese characters