Answer to Question #220549 in C++ for simbarashe

Question #220549
Using C++ Program develop any application that reads marks obtained by a student in a test of 100. Marks and computes his grade according to the following criteria.
Marks>=80 grade=A
Marks>=70 & <80 grade=B
Marks>=60 & <70 grade=C
Marks>=50 & <60 grade=D
otherwise grade=F
1
Expert's answer
2021-07-25T13:18:21-0400
#include <iostream>
using namespace std;
int main(){
    cout<<"Input marks: ";
    int marks; cin>>marks;
    char grade;
    switch(marks/10){
        case 10:;
        case 9:;
        case 8: grade = 'A'; break;
        case 7: grade = 'B'; break;
        case 6: grade = 'C'; break;
        case 5: grade = 'D'; break;
        default: grade = 'F';
    }
    cout<<"Grade: "<<grade;
}

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
APPROVED BY CLIENTS