#include <stdio.h>#include <stdlib.h>#include<time.h>int main(){ int num = 0; srand((unsigned)time(NULL)); int ret = rand() % 100 + 1; while (1) { printf("請(qǐng)猜數(shù)字:>"); scanf_s("%d",&num); if (num == ret) { printf("猜對(duì)了\n"); break; } else if (num > ret) { printf("猜大了\n"); } else { printf("猜小了\n"); } } system("pause"); return 0; }