C++ Program To Calculate Grade Of A Student

Grade Calculator

Grade Calculator is a program to calculate a students grade with marks of  5 subjects. The program is written in C++ by Mufeed VH. This program is not yet compiled to be a software program instead I am sharing its source code.

How To Use?

  1. Copy the entire code shown below in Notepad or any text editor and save it as a file having “.cpp” as its extension
  2. Open it in a C++ compiler and run
  3. Enter the marks obtained by the student in 5 subjects
  4. Run it
  5. You will get the total mark and grade of the student

Source Code (C++)

/* C++ Program – Calculate Grade of Student */

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int mark[5], i;
float sum=0,avg;
cout<<“Enter marks obtained in 5 subjects :”;
for(i=0; i<5; i++)
{
cin>>mark[i];
sum=sum+mark[i];
}
avg=sum/5;
cout<<“Your Grade is “;
if(avg>80)
{
cout<<“A”;
}
else if(avg>60 && avg<=80)
{
cout<<“B”;
}
else if(avg>40 && avg<=60)
{
cout<<“C”;
}
else
{
cout<<“D”;
}
getch();
}

When the above program is compiled and executed, it will produce the following result :

cpp-program-student-grade

Try It Your Own! If You Know Anyone Who Can Have This And Be Useful – Share It Now ! 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s