C语言猜字谜游戏
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
i=0;
while(number!=price)
{
ห้องสมุดไป่ตู้
do
{
printf("please input a number between 1 and 100:\n");
scanf("%d",&number);
printf("your input number is: %d\n",number);
i++;
}while(!(number>=1&&number<=100));
#include<stdio.h>
#include<conio.h>
//getch()函数的头文件
void main()
{
int password=0,i=0,number=0,price=58;
printf("======This is a number guess game!======\n");
if (number>90)
{
printf("too big!press any key to try again!\n");
}
else if(number>70&&number<=90)
{
printf("big!press any key to try again!\n");
}
else if (number<=30)
while(password!=1234)
{
if(i>=3)
{
printf("please input the right password!\n");
return;
}
printf("please input the password:\n");
scanf("%d",&password);
i++;
}
{
printf("too small!press any key to try again!\n");
}
else if (number>30&&number<50)
{
printf("small!press any key to try again!\n");
}
else
{ if(number==price) printf("you are right!your score is %d times!bye bye!\n",i); else if(number<price) printf("sorry!just a little small!press any key to try again!\n"); else printf("sorry!just a little big!press any key to try again!\n");
} getch(); } }