I had this problem before but went around it using other operator. But the same operator can't be used here I think (the getche();
). Anyway this works well and good but if I input a letter it goes into an infinite loop.
printf("Enter the number of the passenger you wish to edit.");
scanf("%d", &userchoice);
do
{
if(userchoice <= count || userchoice <= 1)
{
flag = 0;
}
else
{
printf("Please enter a valid input!");
scanf("%d", &userchoice);
flag = 1;
}
} while (flag == 1);