Calculate Grade Of Student Using C++

What we are going to see through this article is we will see in detail Calculate Grade Of Student Using C++. To calculate a student’s grade in C ++ programming based on his or her grades, you must ask the user to enter the marks you received in certain subjects.

To calculate student quality, first, calculate the score of all subjects and then calculate the average score. Start looking at the standards now to show the result as shown here in the following column.

Calculate Grade Of Student Using C++

Calculate Grade of Student using C++

#include<iostream>
using namespace std;
int main()
{
        int marks[5], i;
        float sum=0,avg;

        cout<<"\n Enter Marks of Student \n";
        cout<<"------------------------------------";
        cout<<"\n Hindi : ";
        cin>>marks[0];
        cout<<"\n English : ";
        cin>>marks[1];
        cout<<"\n Maths : ";
        cin>>marks[2];
        cout<<"\n History : ";
        cin>>marks[3];
        cout<<"\n Science : ";
        cin>>marks[4];

        for(i=0;i<5;i++)
        {
                sum=sum+marks[i];
        }
        cout<<"------------------------------------";
        cout<<"\n Total Marks of Student = "<<sum;
        avg=sum/5;
        cout<<"\n Average = "<<avg;
        cout<<"\n Grade   = ";

        if(avg>80)
        {
                cout<<"A";
        }
        else if(avg>60 && avg<=80)
        {
                cout<<"B";
        }
        else if(avg>40 && avg<=60)
        {
                cout<<"C";
        }
        else
        {
                cout<<"D";
        }
        return 0;
}

Read Also: How To Convert Uppercase To Lowercase In C++?

Output

Calculate Grade of Student using C++ pic

Final Words

What we learned through this article is Calculate Grade Of Student Using C++. Also if you have any doubts please leave a comment via the comment box. And we ask that you benefit everyone who shared this article with your friends.

Leave a Comment