Answer to Question #317615 in C++ for Micheal

Question #317615

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



1
Expert's answer
2022-03-24T13:22:19-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog