Create the program in c++ to compute your final grade in quiz, online laboratory, exam 1, exam 2, and exam 3 with your name and section
#include<iostream>
using namespace std;
int main(){
string name, section;
int quiz, onlineLab, exam1, exam2, exam3, year, average;
cout<<"\nEnter your name: ";
getline(cin, name);
cout<<"\nEnter your section e.g. Information technology: ";
getline(cin, section);
cout<<"\nEnter your year of study e.g. 1: ";
cin>>year;
cout<<"\nEnter your score in the quiz (out of 100): ";
cin>>quiz;
cout<<"\nEnter your score in the online Laboratory (out of 100): ";
cin>>onlineLab;
cout<<"\nEnter your score in the exam 1 (out of 100): ";
cin>>exam1;
cout<<"\nEnter your score in the exam 2 (out of 100): ";
cin>>exam2;
cout<<"\nEnter your score in the exam 3 (out of 100): ";
cin>>exam3;
average=(quiz+onlineLab+exam1+exam2+exam3)/5;
cout<<"\nName : "<<name;
cout<<"\nSection : "<<section;
cout<<"\nYear : "<<year;
cout<<"\nYour average score is : "<<average;
if(average>=70 && average<100){
cout<<"\nGrade A";
}
else if(average>=60 && average<70){
cout<<"\nGrade B";
}
else if(average>=50 && average<60){
cout<<"\nGrade C";
}
else if(average>=40 && average<50){
cout<<"\nGrade D";
}
else{
cout<<"\nFail";
}
}
Comments
Leave a comment