Hello!
I'm attempting to write another program from Let us C book.
Below I'm pasting just a part of the code that is problematic for me:
Code:
main(){
int age;
char male, city, healthy;
printf("what is the age of the person? ");
scanf("%d", &age);
printf("is the person male? ");
scanf ("%c", &male);
printf("is the person living in the city? ");
scanf("%c", &city);
printf("is the person of excellent health? ");
scanf("%c", &healthy);
}
The problem is that when i execute the code, the first printf function is displayed and when i enter the value, the second and third printf function are displayed at the same time, while I'd like the next printf function to be displayed only after i had answered the question before.
Is there anything wrong in the code that prevents that from happening? Or maybe I need some more advanced commands that I haven't read about yet?
I'm using Code::Blocks to compile the program.
Thank you in advance!