当前位置:网站首页>【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;
}
边栏推荐
- 【leetcode】1027. Longest arithmetic sequence (dynamic programming)
- Pat grade B 1009 is ironic (20 points)
- Global and Chinese market of cyanuric acid 2022-2028: Research Report on technology, participants, trends, market size and share
- Plan for the first half of 2022 -- pass the PMP Exam
- Global and Chinese markets for medical temperature sensors 2022-2028: Research Report on technology, participants, trends, market size and share
- Derivation of decision tree theory
- Chapter 1: simplify the same code decimal sum s (D, n)
- Oak-d raspberry pie cloud project [with detailed code]
- Native table - scroll - merge function
- FPGA 学习笔记:Vivado 2019.1 工程创建
猜你喜欢
![AI enhanced safety monitoring project [with detailed code]](/img/a9/cb93f349229e86cbb05ad196ae9553.jpg)
AI enhanced safety monitoring project [with detailed code]

Professional interpretation | how to become an SQL developer
![[effective Objective-C] - block and grand central distribution](/img/09/22b979b97ea13d649b4b904637b79f.jpg)
[effective Objective-C] - block and grand central distribution

How to improve data security by renting servers in Hong Kong

Teach you how to quickly recover data by deleting recycle bin files by mistake

Sparse matrix (triple) creation, transpose, traversal, addition, subtraction, multiplication. C implementation

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

Camera calibration (I): robot hand eye calibration

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

IPv6 experiment
随机推荐
2022 Xinjiang latest construction eight members (standard members) simulated examination questions and answers
Chapter 2: find the classical solution of the maximum Convention and the least common multiple of a and B, find the conventional solution of the maximum Convention and the least common multiple of a a
Microsoft: the 12th generation core processor needs to be upgraded to win11 to give full play to its maximum performance
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Utilisation de base du cadre unitest
PR FAQ: how to set PR vertical screen sequence?
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
Xctf attack and defense world crypto advanced area best_ rsa
kubernetes集群搭建efk日志收集平台
Print linked list from end to end
Chapter 1: seek common? Decimal and S (D, n)
AcWing 1460. Where am i?
Global and Chinese market of two in one notebook computers 2022-2028: Research Report on technology, participants, trends, market size and share
Micro service knowledge sorting - three pieces of micro Service Technology
2166. Design bit set
Professional interpretation | how to become an SQL developer
Chapter 2: find the number of daffodils based on decomposition, find the number of daffodils based on combination, find the conformal number in [x, y], explore the n-bit conformal number, recursively
Win10 share you don't have permission
Test panghu was teaching you how to use the technical code to flirt with girls online on Valentine's Day 520