|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
void main()
{
int user,computer;
char sure;
labal:
srand((int)time(0));
computer=rand()%(0-10);
printf("please input yur number:");
while(1)
{
scanf("%d",&user);
if(user<computer)
printf("you should input a bigger number:");
else if(user>computer)
printf("you should input a smaller number:");
else if(user==computer)
{
printf("congratulation you are right!!!\n");
printf("are you continue (Y/N):");
scanf("%c",&sure); //为什么执行到这里没有停下来等待用户输入????????
sure=toupper(sure);
while(sure!='Y'&&sure!='N')
{
putchar(7);
printf("you should input Y or N:");
scanf("%c",&sure);
sure=toupper(sure);
}
if(sure=='Y')
goto labal;
else if(sure=='N')
exit(0);
}
}
} |
|