C++ student grade program

In this article, you will a c++ program to calculate the student grade. This program asks the user to enter the subject marks the program calculates its grade and displays the result on the screen.

Criteria to calculate student grades.

Criteria RangeGrade
90-100A+
80-89A
70-79B
60-69C
50-59D
Below 50F

Prerequisite

To understand this program, you must have the following programming knowledge.

Example 1: C++ student grade program

//C++ program to calculate student grade
#include <iostream>
using namespace std;

int main(){
    int marks;
    cout<<"Enter student marks: ";
    cin>>marks;
    if (marks >= 90 && marks <=100){
        cout<<"Your grade is A+";
    }
    else if (marks >= 80 && marks <=89){
        cout<<"Your grade is A";
    }
    else if (marks >= 70 && marks <= 79){
        cout<<"Your grade is B";
    }
    else if (marks >= 60 && marks <=69){
        cout<<"Your grade is C";
    }
    else if (marks >= 50 && marks <=59){
        cout<<"Your grade is D";
    }
    else if (marks <=50 && marks>=0){
        cout<<"Your grade is F";
    }
   
    else{
        cout<<"Please enter valid marks";
    }
    return 0;
}

Output: C++ student grade program

Enter student marks: 91
Your grade is A+