When you do a scanf()
it's taking the value you ask for only.. for example:
scanf("%d",&posothta);
Let's say I enter 5
here. Really, stdin
got 2 characters: '5'
and '\n'
(because I had to hit the enter key and that generates a newline character).
So into posothta
goes the 5, but that pesky newline is left sitting there. The next scanf()
now is looking for a character, and since the newline character ('\n'
) is indeed a character, the program doesn't ask questions, it simply picks up that newline and moves on.
Change your code to:
scanf(" %c",&eidos);
Will skip tell scanf()
that "I want you to skip any whitespace characters, then grab the next one". To scanf()
a white space character includes not only spaces, but newlines as well.