Guessing games-don't know why you can't lose Chinese characters

Source: Internet
Author: User


#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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.