23根火柴游戏
如果对各位的思路引导有帮助那更好
发布日期:2021-06-30 22:22:23
浏览次数:2
分类:技术文章
本文共 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
表示我来过!
[***.240.166.169]2024年04月13日 11时18分30秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
攻防世界web进阶区FlatScience详解
2019-04-30
攻防世界web进阶区ics-04详解
2019-04-30
攻防世界web进阶区bug详解
2019-04-30
攻防世界web进阶区ics-07详解
2019-04-30
攻防世界web进阶区unfinish详解
2019-04-30
攻防世界web进阶区i-got-id-200超详解
2019-04-30
sql注入总结学习
2019-04-30
leetcode46 全排列
2019-04-30
leetcode 122 买卖股票的最佳时机II
2019-04-30
leetcode 309 最佳买卖股票含冷冻期
2019-04-30
leetcode 714 买卖股票的最佳时机含手续费
2019-04-30
leetcode3 无重复字符的最长子串
2019-04-30
leetcode 1143. 最长公共子序列
2019-04-30
leetcode 83. 删除排序链表中的重复元素
2019-04-30
智能体 Intelligent Agent
2019-04-30
Python 之 histogram直方图
2019-04-30
Python 之 Scatter散点图
2019-04-30
Python实现决策树 Desision Tree & 可视化
2019-04-30
决策树 Decision tree
2019-04-30
nominal和ordinal & 数据处理中四种基本数据类型
2019-04-30