Hey everyone, I have a question in my program. It basicallytakes the quiz scores
ID: 3616173 • Letter: H
Question
Hey everyone, I have a question in my program. It basicallytakes the quiz scores, midterm and final scores for three studentsand gives out the grade. I got that part, but I am having troublein the letter grade part. For example, if the student grade is morethan or equal to 90, its A, less than 80 is a C and so on. I amposting my code below. Please help me out! Thanks!!#include <iostream> #include <iomanip> using namespace std;
struct StudentRecord{ double q1,q2,mt,final,total; }; int main(){ const int Num_Students=3; StudentRecord student[Num_Students]; int counter,index; for(counter=0;counter<Num_Students;counter++){ cout<<"Enter quiz score 1 of Student"<< (counter + 1); cout <<": "; cin>>student[counter].q1; cout<<"Enter quiz score 2 of Student"<< (counter + 1); cout <<": "; cin>>student[counter].q2; cout<<"Enter Midterm score ofStudent "<< (counter + 1); cout <<": "; cin>>student[counter].mt; cout<<"Enter final exam score ofStudent "<< (counter + 1); cout <<": "; cin>>student[counter].final; } double qt1,qt2,QT,MT,FINAL,total; for(index=0;index<Num_Students;index++){ qt1=(student[index].q1)*1.25; qt2=(student[index].q2)*1.25; QT=qt1+qt2; MT=(student[index].mt)*.25; FINAL=(student[index].final)*0.5; total=QT+MT+FINAL; cout<<"Student # "<<(index+1); cout<<" scored"<<total<<endl; } for(int k=0;k<Num_Students;k++){ if(student[k].total>=90) cout<<"Student # "<<(k+1)<<"scored A"<<endl; } system("pause"); return 0; } I have a question in my program. It basicallytakes the quiz scores, midterm and final scores for three studentsand gives out the grade. I got that part, but I am having troublein the letter grade part. For example, if the student grade is morethan or equal to 90, its A, less than 80 is a C and so on. I amposting my code below. Please help me out! Thanks!!
#include <iostream> #include <iomanip> using namespace std;
struct StudentRecord{ double q1,q2,mt,final,total; }; int main(){ const int Num_Students=3; StudentRecord student[Num_Students]; int counter,index; for(counter=0;counter<Num_Students;counter++){ cout<<"Enter quiz score 1 of Student"<< (counter + 1); cout <<": "; cin>>student[counter].q1; cout<<"Enter quiz score 2 of Student"<< (counter + 1); cout <<": "; cin>>student[counter].q2; cout<<"Enter Midterm score ofStudent "<< (counter + 1); cout <<": "; cin>>student[counter].mt; cout<<"Enter final exam score ofStudent "<< (counter + 1); cout <<": "; cin>>student[counter].final; } double qt1,qt2,QT,MT,FINAL,total; for(index=0;index<Num_Students;index++){ qt1=(student[index].q1)*1.25; qt2=(student[index].q2)*1.25; QT=qt1+qt2; MT=(student[index].mt)*.25; FINAL=(student[index].final)*0.5; total=QT+MT+FINAL; cout<<"Student # "<<(index+1); cout<<" scored"<<total<<endl; } for(int k=0;k<Num_Students;k++){ if(student[k].total>=90) cout<<"Student # "<<(k+1)<<"scored A"<<endl; } system("pause"); return 0; }