| IronmanCro (37) | ||
|
This is what happens if i use %c, it looks like it doesn't follow the if-else if mechanics. Seams after the do while loop is finished it just skips first scanf, does the else if part and then the 2nd scanf works resulting in:
| ||
|
Last edited on
|
||
| Cubbi (1927) | |
Yes, this is exactly the expected output if you're using scanf("%c", &choice);. As mentioned earlier in this thread, your intention was most likely to use scanf(" %c", &choice);.If your textbook doesn't explain what the space character does in scanf, it probably misses on a lot of other C basics. | |
|
|
|
| IronmanCro (37) | ||
Indeed, it worked after i tried out what you guyz said i should do. In previous post i was just replying to freddie's question.
| ||
|
Last edited on
|
||
| LobitoMalo (1) | |
|
ok after every "printf" use the centence "fflush(stdout);" example --------------------------------------- #include <stdio.h> int main (){ itn a; printf ("put something"); fflush(stdout); scanf("%d",&a); printf ("you type %d\n",a) fflush(stdout); return 0} -------------------------------------- the problem is only in the eclipse, if you run your program in the windows terminal worcs fine regards | |
|
|
|