0

Hey guys i have been working on a report card program lately and i hit a hard place i used a do-while but i cant restrict characters from being posted without the program crashing and i don't wanna be monotamous so can u guys help heres a piece of the code

phys: // this is the report error system//

 do {

               printf ("Input physics grade :\n");
                scanf("%f", &phys );


                 if (phys > 100|| phys <0) {

                     printf("Skipping the value\n");
                     fflush(stdin);
                      continue;
                      /* jumps to second iteration */

                 }

this is a part of my code so could you help me?

3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by Adak
0

fflush(stdin) is like trying to flush your kitchen sink.

Flushing only works on output streams (like the toilet in your home), not on input streams, like your kitchen faucet. ;)

Edited by Adak: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.