1条回答 默认 最新
- CSDN专家-赖老师(软件之家) 2021-06-23 00:08关注
#include<stdio.h> #include<stdlib.h> #include<time.h> void main() { int ret = 0; int i = 0; int rnd = 0; int level = 10; srand((unsigned int)time(NULL)); ret = rand()%90; printf("Ganestart!\n"); while(1) { printf("请输入一个数:"); scanf("%d",&rnd); if(rnd>ret){ printf("Too big! \n"); }else if(rnd<ret){ printf("Too small! \n"); }else{ break; } level--; if(level<=0){ printf("You Failed! The aumber is r"); exit(0); } } switch(level){ case 10: printf("Congratulation! Your gessind Lerel is S"); break; case 9: printf("Congratulation! Your gessind Lerel is A"); break; case 8: printf("Congratulation! Your gessind Lerel is B"); break; case 7: printf("Congratulation! Your gessind Lerel is C"); break; case 6: printf("Congratulation! Your gessind Lerel is D"); break; case 5: case 4: case 3: case 2: case 1: case 0: printf("Congratulation! Your gessind Lerel is E"); break; } return 0; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 关于#hadoop#的问题
- ¥15 (标签-Python|关键词-socket)
- ¥15 keil里为什么main.c定义的函数在it.c调用不了
- ¥50 切换TabTip键盘的输入法
- ¥15 可否在不同线程中调用封装数据库操作的类
- ¥15 微带串馈天线阵列每个阵元宽度计算
- ¥15 keil的map文件中Image component sizes各项意思
- ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
- ¥15 划分vlan后,链路不通了?
- ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据