1 /* Note:Your choice is C IDE */ 2 #include "stdio.h" 3 #include <stdlib.h> 4 #include<time.h> 5 void main() 6 { 7 int i,j; 8 srand((unsigned)time(NULL));//生成不重复的随机数stdlib.h 9 j=rand() %100;// 10 printf("!!!!请输入一个100以内的整数!!! "); 11 while(1) 12 13 { 14 scanf("%d",&i); 15 if(i<j) 16 { 17 printf("太小了 "); 18 19 }else if(i>j){ 20 printf("太大了 "); 21 22 }else{ 23 printf("恭喜,猜对了!! "); 24 25 break; 26 } 27 } 28 }