当前位置:网站首页>【c】 Digital bomb
【c】 Digital bomb
2022-07-03 20:06:00 【Paradox 502】
void game()
{
int b = 0;
int let = 0;
let=rand()%100+1;
int left = 0;
int right = 100;
while (b != let)
{
printf(" Guess the number >:");
(void)scanf("%d", &b);
/*Sleep(1000)*/;
system("CLS");
if (b < let && b>left)
{
left = b;
printf(" Less than the number of bombs \n The scope is %d-%d\n",left,right);
}
else if (b > let && b<right)
{
right = b;
printf(" Larger than the number of bombs \n The scope is %d-%d\n", left, right);
}
/*if (b <= left || b >=right)*/
else if(b>right||b<left)
printf(" Out of range, please input again \n The scope is %d-%d\n", left, right);
}
printf("\ngame over\n");
}
void menu()
{
printf("*******************************\n");
printf("***** 1.play 0.exit *******\n");
printf("*******************************\n");
}
int main()
{
srand((unsigned int)time(NULL));
int input = 0;
do
{
menu();
printf(" Please select >:");
(void)scanf("%d", &input);
switch (input)
{
case 1:
game();
break;
case 0:
printf(" Quit the game \n");
break;
default:
printf(" Wrong choice \n");
break;
}
} while (input);
return 0;
}
边栏推荐
- 2022 Xinjiang latest road transportation safety officer simulation examination questions and answers
- Day11 - my page, user information acquisition, modification and channel interface
- 2.7 format output of values
- 2.3 other data types
- Typora charges, WTF? Still need support
- Nerfplusplus parameter format sorting
- PR FAQ: how to set PR vertical screen sequence?
- 1.4 learn more about functions
- Kubernetes cluster builds efk log collection platform
- Test changes in Devops mode -- learning and thinking
猜你喜欢
2.3 other data types
AcWing 1460. Where am i?
Part 28 supplement (XXVIII) busyindicator (waiting for elements)
5- (4-nitrophenyl) - 10,15,20-triphenylporphyrin ntpph2/ntppzn/ntppmn/ntppfe/ntppni/ntppcu/ntppcd/ntppco and other metal complexes
JMeter connection database
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Chapter 1: simplify the same code decimal sum s (D, n)
AI enhanced safety monitoring project [with detailed code]
2022-07-02 advanced network engineering (XV) routing policy - route policy feature, policy based routing, MQC (modular QoS command line)
PR 2021 quick start tutorial, how to create a new sequence and set parameters?
随机推荐
[raid] [simple DP] mine excavation
Global and Chinese market of two in one notebook computers 2022-2028: Research Report on technology, participants, trends, market size and share
Today's work summary and plan: February 14, 2022
Global and Chinese market of speed limiter 2022-2028: Research Report on technology, participants, trends, market size and share
kubernetes集群搭建efk日志收集平台
2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP
WPF format datetime in TextBlock- WPF format DateTime in TextBlock?
2.3 other data types
Geek Daily: the system of monitoring employees' turnover intention has been deeply convinced off the shelves; The meta universe app of wechat and QQ was actively removed from the shelves; IntelliJ pla
Xctf attack and defense world crypto advanced area best_ rsa
Parental delegation mechanism
Utilisation de base du cadre unitest
2.1 use of variables
unittest框架基本使用
BOC protected amino acid porphyrins TAPP ala BOC, TAPP Phe BOC, TAPP Trp BOC, Zn · TAPP ala BOC, Zn · TAPP Phe BOC, Zn · TAPP Trp BOC Qiyue
Global and Chinese markets of polyimide tubes for electronics 2022-2028: Research Report on technology, participants, trends, market size and share
Part 27 supplement (27) buttons of QML basic elements
Use of aggregate functions
Global and Chinese market of high temperature Silver sintering paste 2022-2028: Research Report on technology, participants, trends, market size and share
2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】