没有合适的资源?快使用搜索试试~ 我知道了~
本文实例为大家分享了C语言实现数字炸弹小游戏的具体代码,供大家参考,具体内容如下 使用的是C语言 # 内容 #include<stdio> #include<stdlib> int main(){ //变量 char c_TheRequest = 1;//开始界面的字符 int in_Deltar = 1,in_EnteredNumber,in_Sig;//游戏中输入数字及其判定所需要的数字 int in_GivenNum = 0,in_An = 0,in_Bn = 0;//出的数字,和数字区间 int in_Mid1,in_Mid2;//用来交换An、Bn的值以满足An<
资源推荐
资源详情
资源评论
C语言实现数字炸弹小游戏语言实现数字炸弹小游戏
本文实例为大家分享了C语言实现数字炸弹小游戏的具体代码,供大家参考,具体内容如下
使用的是C语言
# 内容
#include<stdio.h>
#include<stdlib.h>
int main(){
//变量
char c_TheRequest = 1;//开始界面的字符
int in_Deltar = 1,in_EnteredNumber,in_Sig;//游戏中输入数字及其判定所需要的数字
int in_GivenNum = 0,in_An = 0,in_Bn = 0;//出的数字,和数字区间
int in_Mid1,in_Mid2;//用来交换An、Bn的值以满足An<Bn的中间量
int in_DistantAn,in_DistantBn;//An与Bn离num的距离
int in_TemporaryAnSaver,in_TemporaryBnSaver;//临时用于比较的An、Bn储存器
//开始界面
printf("If you just happen to open the game and do not have the intention to play it.");
printf("You can enter a q to quit or you can enter an s to start the game now!");
scanf("%c",&c_TheRequest);
getchar();
while (c_TheRequest != 's' && c_TheRequest != 'q'){
printf("Please do not enter a irrelevant letter.");
scanf("%c",&c_TheRequest);
getchar();
}
if(c_TheRequest == 'q'){
printf("So sad then.Hope you can play with me next time.");
getchar();
}
//游戏
if(c_TheRequest == 's'){
//输入“数字炸弹”
system("cls");
printf("(^ o ^) # *** NOW LET\'S PLAY! *** # (^ o ^)Attention!You can only enter numbers in the following steps.\nEnter to
start.");
getchar();
system("cls");
printf("Game : The number boom!(Another Life.)");
printf("Rule:");
printf("The first player should enter a number.Then he should give to numbers and guarantee the number above is between
them.");
printf("The rest should guess and enter the numbers.And the one who enter the exact number the first player entered");
printf("is supported to be the winner!");
printf("Please Enter a number to start the game.(You is ought not to expose it to other players.The number should bigger
than 0.)");
printf("__________\b");
while(scanf("%d",&in_GivenNum) != 1 || in_GivenNum < 0){
system("cls");
printf("Please Enter a NUMBER which is bigger than 0.");
printf("num:___________");
getchar();
}
system("cls");
//判定是否为数字
//输入“数字炸弹”所在的区间
printf("And where is the number?Please enter two numbers,and ensure that the number above is between them.");
printf("Additionally,there should be at least 100 numbers between the two numbers you will enter.");
do{
printf("num = %d",in_GivenNum);
printf("A:__________");
while(scanf("%d",&in_An)!=1){
printf("Please Enter a NUMBER which is bigger or smaller than the \"num\"!!!!");
printf("A:__________");
资源评论
weixin_38501299
- 粉丝: 3
- 资源: 922
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功