任何人都可以在这个程序中提供帮助吗?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
srand(time(NULL));
int r = rand();
int op = 0;
while(0==0){
printf("Enter a value\n ");
scanf("%i\n",&op);
if (op == r ){
printf("yes");
break;
}
else if( op<r)
printf("Your guess is lower than the number");
else
printf("Your guess is higher than the number");
}
printf("%i",r);
return 0;
}
当我在“终端”中尝试程序时,结果总是:你的猜测低于数字
我不知道发生了什么事?但是当我在 Windows 中使用代码块时,它似乎很完美。
这个问题是来自 Linux 还是编译器
我在终端中写了 cc main.c 然后“./a.out”