Hey Guys,
This is my function..when I put in 'b' or 'c' or 't' it works just fine..type in 'j' and the output looks like this..Why is it doing that..help please! Thanks
Aspan
Output:
What kind of car would you like to park?
(C)ar or (B)us or (T)ruck:j
What kind of car would you like to park?
(C)ar or (B)us or (T)ruck:
What kind of car would you like to park?
(C)ar or (B)us or (T)ruck:
CODE:
char inputCar(void)
{
char c;
char car;
printf("What kind of car would you like to park?\n");
printf("(C)ar or (B)us or (T)ruck:");
scanf("%c", &car);
c = toupper(car);
while(!(c == 'C' || c == 'B' || c == 'T'))
{
printf("What kind of car would you like to park?\n");
printf("(C)ar or (B)us or (T)ruck:\n");
scanf("%c", &car);
c = toupper(car);
}
return c;
}