int Choicepass()

{
int n,T,L,S1,S2,S3;
char M;
printf("Please choose the model:\na->easy\nb->normal\nc->difficulty\n:");
scanf("%c",&M);

``````switch(M)                                                        //选择难度所用函数
{
case 'a':
{
srand(time(0));
n = rand()%10+1;
T = 3;
S1 = Guess1(n,T);
}break;
case 'b':
{
srand(time(0));
n = rand()%50+1;
printf("You should get the answer from 1~50.\nPlease choose the TimesLimit(5~10):");
scanf("%d",&T);
S2 = Guess2(n,T);
}break;
case 'c':
{
srand(time(0));
n = rand()%100+1;
printf("You should get the answer from 1~100.\nPlease choose the TimesLimit(5~15):");
scanf("%d",&T);
S3 = Guess3(n,T);
}break;
}
L = 1;
return L ;
``````

}

``````    /*选择关卡模式或者选择难度模式*/
``````

int Choose()
{
int L,T;
char k,h;

printf("选择关卡模式或者自由选择难度模式:\ng->关卡\nz->自由:");
scanf("%c",&h);

``````if(h == 'c')

L = Customspass();

else if(h == 'z')

L = Choicepass();

else printf("ERROR!\n");

printf("是否重新进行?\nc->继续\ne->退出:");
scanf("%c",&k);

if(k == 'c')

T = Choose();

else
printf("游戏结束!\n");

return T;
``````

}

1个回答