#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
srand(time(0));
int number=rand()%100+1;
int count =0;
int a =0;
printf(“I already have a number between 0 and 100, so guess!\n”);
do{
printf(“Guess the number between 0 and 100:”);
scanf("%d",&a);
count++;
if(a>number){
printf(“Your guess is too big!Come on!\n”);
}else if(a<number){
printf(“Your guess is too small!Come on!\n”);
}
} while(a!=number);
printf(“Congratulations, you got it right %d times. That was smart!”,count);
return 0;
}
C语言猜字游戏---翁凯
最新推荐文章于 2023-11-16 10:01:38 发布