I'm doing a program for school and this piece of code won't work...
// This function gets the user to input the percent grade and returns the
// rounded version of that value.
int input_grade (void)
// This variable is the percent grade and is input by the user. It is set to 150
// so the 'while' loop will function correctly.
// This variable hold the value of the rounded percent grade.
// This loop lets the user re-enter the percentage grade if it is invalid.
while (per_grd>100 || per_grd <0)
// Gets the user to input the percentage grade.
printf ("Enter percentage grade: ");
cin >> per_grd;
// The following checks it make sure the input is valid and if it is not, it
// displays an error message.
if (per_grd>100 || per_grd <0)
// Prints an error message to the screen, gets the user to press
// any key to continue then clears the screen. The loop then restarts.
printf ("\nTHAT IS AND INVALID ENTRY...PLEASE RE-ENTER!\n\n");
// Calls the round function then assigns the value to the 'round_grd'
// Returns the value of the rounded grade.
... When you enter a letter the loop works, but it won't let you re-enter the value and just loops continuously.
PS. I have attached the full code... please take a look and reply...