#include#include #include #define N 10 int main() { srand(time(NULL)); int res=rand()%10+1,n; printf("--猜数字(1-%d)--n",N); while(1) { printf("输入:");scanf("%d",&n); if(n==res)break; else if(n>res)printf("大了哦n"); else printf("小了哦n"); } printf("恭喜你猜中了!"); return 0; }


![[C语言]猜数字极简版 [C语言]猜数字极简版](http://www.mshxw.com/aiimages/31/511066.png)
