0% found this document useful (0 votes)
103 views7 pages

Exam Sheet C++ Program

The document contains code to calculate grades and grade point averages (GPAs) for a student based on their marks in different subjects. It takes marks as input from the user, calculates the percentage and overall grade. It then calculates individual grades and GPAs for each subject based on predetermined criteria. Finally, it outputs the student's mark sheet, grade sheet and GPA sheet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views7 pages

Exam Sheet C++ Program

The document contains code to calculate grades and grade point averages (GPAs) for a student based on their marks in different subjects. It takes marks as input from the user, calculates the percentage and overall grade. It then calculates individual grades and GPAs for each subject based on predetermined criteria. Finally, it outputs the student's mark sheet, grade sheet and GPA sheet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

#include<iostream>

#include<conio.h>
using namespace std;
int main ()
{
//input
string name,grade,fpgrade,psgrade,itcgrade,phygrade,calgrade;
int roll=1,fp,itc,cal,phy,ps,tot=500,obt,x;
float cgpa,fpgpa,psgpa,itcgpa,calgpa,phygpa;
cout<<"enter roll no\t\t";
cin>>roll;
cout<<"enter Name\t\t";
cin.ignore();
getline(cin,name);
cout<<"Marks obtained in Fundamental Programming out of 100\t\t";
cin>>fp;
cout<<"Marks obtained in ITC out of 100\t\t\t\t";
cin>>itc;
cout<<"Marks obtained in Calculus out of 100\t\t\t\t";
cin>>cal;
cout<<"Marks obtained in Physics out of 100\t\t\t\t";
cin>>phy;
cout<<"Marks obtained in Pak Std out of 100\t\t\t\t";
cin>>ps;
//calculations
obt=fp+itc+cal+phy+ps;
x=(obt*100)/tot;
//grading
{

if(x>=90)
{
grade='A';
}
else if(x>=80)
{
grade='B';
}
else if(x>=70)
{
grade='C';
}
else if(x>=60)
{
grade='D';
}
else
grade='F';

}
// gpa
//grading fp
{

if(fp>=95)
{
fpgrade="A+";
fpgpa=4.0;
}
else if(fp>=90)
{
fpgrade="A-";
fpgpa=3.7;
}
else if(fp>=85)
{
fpgrade="B+";
fpgpa=3.3;
}
else if(fp>=80)
{
fpgrade="B-";
fpgpa=3.0;
}
else if(fp>=75)
{
fpgrade="C+";
fpgpa=2.7;
}
else if(fp>=70)
{
fpgrade="C-";
fpgpa=2.5;
}
else if(fp<70)
{
fpgrade="D";
fpgpa=2.0;
}
else
{
fpgrade="F";
fpgpa=0;
}

}
// gpa
//grading phy
{

if(phy>=95)
{
phygrade="A+";
phygpa=4.0;
}
else if(phy>=90)
{
phygrade="A-";
phygpa=3.7;
}
else if(phy>=85)
{
phygrade="B+";
phygpa=3.3;
}
else if(phy>=80)
{
phygrade="B-";
phygpa=3.0;
}
else if(phy>=75)
{
phygrade="C+";
phygpa=2.7;
}
else if(phy>=70)
{
phygrade="C-";
phygpa=2.5;
}
else if(phy<70)
{
phygrade="D";
phygpa=2.0;
}
else
{
phygrade="F";
phygpa=0;
}

}
// gpa
//grading cal
{

if(cal>=95)
{
calgrade="A+";
calgpa=4.0;
}
else if(cal>=90)
{
calgrade="A-";
calgpa=3.7;
}
else if(cal>=85)
{
calgrade="B+";
calgpa=3.3;
}
else if(cal>=80)
{
calgrade="B-";
calgpa=3.0;
}
else if(cal>=75)
{
calgrade="C+";
calgpa=2.7;
}
else if(cal>=70)
{
calgrade="C-";
calgpa=2.5;
}
else if(cal<70)
{
calgrade="D";
calgpa=2.0;
}
else
{
calgrade="F";
calgpa=0;
}

}
// gpa
//grading itc
{

if(itc>=95)
{
itcgrade="A+";
itcgpa=4.0;
}
else if(itc>=90)
{
itcgrade="A-";
itcgpa=3.7;
}
else if(itc>=85)
{
itcgrade="B+";
itcgpa=3.3;
}
else if(itc>=80)
{
itcgrade="B-";
itcgpa=3.0;
}
else if(itc>=75)
{
itcgrade="C+";
itcgpa=2.7;
}
else if(itc>=70)
{
itcgrade="C-";
itcgpa=2.5;
}
else if(itc<70)
{
itcgrade="D";
itcgpa=2.0;
}
else
{
itcgrade="F";
itcgpa=0;
}

}
// gpa
//grading ps
{

if(ps>=95)
{
psgrade="A+";
psgpa=4.0;
}
else if(ps>=90)
{
psgrade="A-";
psgpa=3.7;
}
else if(ps>=85)
{
psgrade="B+";
psgpa=3.3;
}
else if(ps>=80)
{
psgrade="B-";
psgpa=3.0;
}
else if(ps>=75)
{
psgrade="C+";
psgpa=2.7;
}
else if(ps>=70)
{
psgrade="C-";
psgpa=2.5;
}
else if(ps<70)
{
psgrade="D";
psgpa=2.0;
}
else
{
psgrade="F";
psgpa=0;
}

}
//output
cgpa=(fpgpa+itcgpa+phygpa+calgpa+psgpa)/5;
//marks
cout<<"\n\n\t\t\t MARK SHEET\n";

cout<<"Name\t"<<"Rol#\t"<<"F.P\t"<<"ITC\t"<<"Cal\t"<<"Phy\t"<<"PS\t"<<"Tot\t"<<"Obt
\t"<<endl;
cout<<name<<"\t"<<roll<<"\t"<<fp<<"\t"<<itc<<"\t"<<cal<<"\t"<<phy<<"\t"<<ps<<"\t"<<
tot<<"\t"<<obt<<"\t"<<endl;
cout<< "\npercentage = "<<x;
cout<<"\nGrade = "<<grade;
//grade
cout<<"\n\n\t\t\t GRADE SHEET\n";
cout<<"Name\t"<<"Rol#\t"<<"F.P\t"<<"ITC\t"<<"Cal\t"<<"Phy\t"<<"PS\t"<<endl;

cout<<name<<"\t"<<roll<<"\t"<<fpgrade<<"\t"<<itcgrade<<"\t"<<calgrade<<"\t"<<phygra
de<<"\t"<<psgrade<<"\t"<<endl;
//gpa
cout<<"\n\n\t\t\t GPA SHEET\n";
cout<<"Name\t"<<"Rol#\t"<<"F.P\t"<<"ITC\t"<<"Cal\t"<<"Phy\t"<<"PS\t"<<endl;

cout<<name<<"\t"<<roll<<"\t"<<fpgpa<<"\t"<<itcgpa<<"\t"<<calgpa<<"\t"<<phygpa<<"\t"
<<psgpa<<"\t"<<"\n\n\ntotal Cgpa 4"<<"\t"<<"\n\n\nObtained gpa"<<cgpa<<"\t"<<endl;
getch();

You might also like