#include <stdlib.h>
#include <time.h>
int main()
{
int num, guess;
srand(time(0));
num = rand() %100 + 1;
do {
printf("请输入一个数字(1-100): ");
scanf(" d", &guess);
if (guess >num) {
printf("太大了!n");
}else if (guess< num){
printf( "太小了! ln");
}
} while (guess I= num) ;
printf("猜对了!ln");
return 0;
}
标签:guess,num,数字,int,代码,小游戏,printf,100,include From: https://blog.51cto.com/u_16271069/7704819