#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int main() {
srand(time(0));
int a=rand()%100+1;
//printf("%d",a);
int number;
int count=0;
do {
scanf("%d",&number);
count++;
if (number>a){
printf("你猜的数字大了!");
}else if(number<a){
printf("你猜的数字小了!");
}
}while (number!=a);
printf ("太棒了!你只用了%d次,数字为%d",count,a);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: