Write a program to ask the user to input a value representing a score on a test. The value entered should be between 0 and 100. Use a IF control structure to output a message containing the letter grade corresponding to the score using the following table. Include pseudocode and flowchart
Score Letter grade
0-40 F
41-55 D
56-70 C
71-85 B
86-100 A
#include <iostream>
using namespace std;
int main() {    
    int value;
    cout<<"Enter a value representing a score on a test between 0 and 100:  ";
    cin>>value;
        
    if(value>=0 && value<=40)
        cout<<"Grade F";
    else if(value>=41 && value<=55)
        cout<<"Grade D";
    else if(value>=56 && value<=70)
        cout<<"Grade C";    
    else if(value>=71 && value<=85)
        cout<<"Grade B";
    else if(value>=86 && value<=100)
        cout<<"Grade A";    
    else
        cout<<"Error. Value must been between 0 and 100 ";    
    cout<<endl;
    return 0;
}
Comments