私は 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()
{
}