23根火柴游戏
如果对各位的思路引导有帮助那更好
发布日期:2021-06-30 22:22:23
浏览次数:3
分类:技术文章
本文共 1598 字,大约阅读时间需要 5 分钟。
Mooc课后习题集 及 做到的一些有趣的题
这是我初学c开始有意识的记录自己做的每一道题开始写下的代码水平 一个一个代码发出来 直到我现在学的数据结构 那个时候还不会注释 格式什么的也是按照自己怎么喜欢怎么来 如果真不会看会代码理解一下 qwq 如代码有错请见谅 毕竟都好久以前敲得了hhh ~~
#includeint main(){ int i=23,n,computertemp; printf("Game start!\n"); printf("Note: the maximum number is 3\n"); do { printf("Please enter the number of matches you are moving:\n"); scanf("%d",&n); i-=n; if(n>3 || n<=0 || i<0) { printf("The number you entered is wrong£¬please re-enter!\n"); i+=n; } else { printf("The number of matches you are moving is %d:\n",n); printf("The number of matches left is: %d\n",i); if(i==3) { printf("The number of matches that have been moved by the computer is: %d\n",2); i-=2; printf("The number of matches left is:%d\n",1); } else if(i==2 ||i==1) { printf("The number of matches that have been moved by the computer is: %d\n",1); printf("The number of matches left is:%d\n",--i); } if(i==0) printf("Congratulations£¡You won!\n"); else { computertemp=i%3+1; printf("The number of matches that have been moved by the computer is: %d\n",computertemp); i-=computertemp; printf("The number of matches left is:%d\n",i); } fflush(stdin); } }while(i>0); return 0;}
转载地址:https://love6.blog.csdn.net/article/details/110242074 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
哈哈,博客排版真的漂亮呢~
[***.90.31.176]2024年04月29日 09时37分20秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
牛客国庆集训派对Day5——L 数论之神(找规律/数论)
2019-04-30
CodeForces - 629B Far Relative’s Problem(模拟)
2019-04-30
CodeForces - 456C Boredom (dp)
2019-04-30
CodeForces - 675A Infinite Sequence(简单数论 细节)
2019-04-30
CodeForces - 1042B Vitamins (思维)
2019-04-30
ACM 2013 长沙区域赛 Collision (几何)
2019-04-30
ACM 2014 鞍山区域赛 E - Hatsune Miku (dp)
2019-04-30
反向传播&梯度下降 的直观理解程序(numpy)
2019-04-30
CodeForces - 931B World Cup (思维 模拟)
2019-04-30
ACM 2017 北京区域赛 J-Pangu and Stones(区间dp)
2019-04-30
POJ - 3517 And Then There Was One (约瑟夫环变式)
2019-04-30
CodeForces 591C Median Smoothing(思维 模拟)
2019-04-30
mac || Linux 命令行下实现批量重命名
2019-04-30
java常用类 String面试题
2019-04-30
Windows10下的powershell美化教程
2019-04-30
利用ffmpeg合并音频和视频
2019-04-30