急需一个用C#编程的猜谜游戏?
# include & ltstdio.h & gt
# include & ltstdlib.h & gt
int main(int argc,char *argv[])
{
int x;//存储随机生成的数字进行猜测。
int I;
int iUserguess//猜数字
int iSelect//选择的难度
//====================================================
for(;;)
{
printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = \ n ");
printf("欢迎使用数字拼图。\ n ");
printf("选择级别:\ n ");
printf(" 1 & gt;易(0-30)\ n ");
printf(" 2 & gt;正常(0-50)\ n ");
printf(" 3 & gt;硬(0-100)\ n ");
printf(" 4 & gt;退出\ n ");
printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = \ n ");
scanf("%d ",& ampiSelect);
开关(iSelect)
{
案例1:
x = rand()% 30;
打破;
// -
案例二:
x = rand()% 50;
打破;
// -
案例三:
x = rand()% 100;
打破;
// -
默认值:
返回0;
}
for(I = 5;我& gt0;-我)
{
printf("您有%d处修改!\n”,I);
scanf("%d ",& ampiuser guess);
if( iUserguess == x)
{
printf("猜对了!\ n ");
系统(“暂停”);
打破;
}
if(iuser guess & gt;x)
{
printf("Big(用户的猜测& gtx)\ n ");
继续;
}
printf("小(网友的猜测& ltx)\ n ");
if( 1 == i)
{
printf("没有变化!再试一个!\ n ");
系统(“暂停”);
}
}
}
系统(“暂停”);
返回0;
}