我是 c 编程的新手,但我只是不明白为什么这段代码在编译后无法正常运行。现在,我只希望它取 10 到 100 之间的数字而不会出错。然后稍后我将添加 return 1 表示错误,0 表示成功。
#include <stdio.h>
#include <stdlib.h>
int intGet(int, int);
int error();
int main(void)
{
int Min, Max, UserIn;
Min = 10;
Max = 100;
printf("Enter a number in between [10 -100]: \n");
scanf("%d", &UserIn);
printf("Read %d\n", UserIn);
while (UserIn < Min && UserIn > Max)
{
printf("Invalid \n");
scanf("%d", &UserIn);
}
/* What I did to fix
while ((UserIn > Min) || (UserIn < Max)){
printf("Enter a number in between [10 -100]: \n");
scanf("%d",&UserIn);
printf("Read %d\n",UserIn);
while ((UserIn < Min) || (UserIn > Max)){
printf("Invalid \n");
scanf("%d", &UserIn);
printf("Read %d\n", UserIn);
}
}*/
return EXIT_SUCCESS;
}
int intGet(int min, int max)
{
}
int error()
{
}