Consider following fig.. Take phy,chem,math for first sem and EGG,PPs,BEL for second sem, print result eith roll no and name in first year
result
#include<iostream>
using namespace std;
int main()
{
string name;
int phy, chem, math, EGG, PPs, BEL, roll_no, average, sum;
cout<<"\nFIRST SEMESTER EXAMS";
cout<<"\nEnter the name of the student: ";
getline(cin, name);
cout<<"\nEnter the student's roll number(e.g 501, numbers only): ";
cin>>roll_no;
cout<<"\nNow Enter first semester marks as for each subject guided below";
cout<<"\nPhysics: ";
cin>>phy;
cout<<"\nChemistry: ";
cin>>chem;
cout<<"\nMathematics: ";
cin>>math;
cout<<"\nNow Enter second semester marks as for each subject guided below";
cout<<"\nEGG: ";
cin>>EGG;
cout<<"\nPPs: ";
cin>>PPs;
cout<<"\nBEL: ";
cin>>BEL;
  cout<<"\nName of the student: "<<name;
cout<<"\n Student's roll numer: "<<roll_no;
cout<<"\n\nSEMESTER ONE RESULT";
cout<<"\n Physics   : "<<phy;
cout<<"\n Chemistry  : "<<chem;
cout<<"\n Mathematcs : "<<math;
Â
cout<<"\n\nSEMESTER TWO RESULT";
cout<<"\n EGGÂ Â Â : "<<EGG;
cout<<"\n PPs   : "<<PPs;
cout<<"\n BELÂ Â Â : "<<BEL;
sum= phy+chem+math+EGG+PPs+BEL;
average= sum/6;
cout<<"\nThe Overrall grade for the YEAR";
  cout<<"\nTOTAL MARKS: "<<sum<<"\n";
cout<<average<<": ";
if(average>=80 && average<=100){
cout<<"A";
}
else if(average>=70 && average<80){
cout<<"B";
}
else if(average>=60 && average<70){
cout<<"c";
}
else if(average>=60 && average<70){
cout<<"D";
}
else{
cout<<"FAIL";
}
 return 0;
}
Comments
Leave a comment