I am trying to figure out how to set a float for a project I am doing. Example I am trying to set a float for a score but I would like the input to be set where you can't input a number over a 100. This is the code I have wrote so far and it work fine beside I am able to input numbers over 100. Would like some advice on this thanks.

#include <iostream>

 using namespace std ;

 int main() 
{

	//Declaring varibles

    float score;// Class Score  
	char grade ;// Class Grade
	 
	
     // read in total score 

     cout << endl ;
     cout << "Enter total score (float, must be <= 100) : " ; 
     cin >> score ; 

 if (score >= 85)  

         grade = 'A';  

     else if (score >= 75)   

          grade = 'B';  

        else if (score >= 65)   

              grade = 'C';  

           else if (score >= 55) 

                  grade = 'D';  

                else  
						grade = 'F'; 
		  
			

     // display the result 

     ;cout << endl ; 
     cout << "Your grade for CMIS 102 is: " << grade << endl ; 

     return (0); // terminate with success



}

General pseudocode:

float userInput;
bool goodData;

do
{
    goodData = true;

    // ask the user for input, stick the input in userInput

    // test whether the user input is good
    if(/* test for good input fails */)
    {
        // display error message
        goodData = false;
    }
}
while(!goodData);

// now you have good input.  Proceed.
This question has already been answered. Start a new discussion instead.