A C++ program that asks the program asks the user to enter the number of student
ID: 3769456 • Letter: A
Question
A C++ program that asks the program asks the user to enter the number of students in a class and then asks the teacher to input student' name and three grades for each student. After the teacher enters the three grades of a student, the program should display the student's name, average score and letter grade. Basically you must repeat the logic developed in projects 1 and 2 combined for a given number of students provided by the user. get the number of students while (i < NumStudents) get student name get student grades cal gpa and letter grade diplay ... i = i + 1 end while
Explanation / Answer
c++ code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int num_of_stu;
cout<<"Please enter number of students : ";
cin>>num_of_stu;
string stu_name;
int g1,g2,g3;
int i=0;
while(i<num_of_stu){
cout<<"Please enter student's name : ";
cin>>stu_name;
cout<<"enter 1st grade : ";
cin>>g1;
cout<<"enter 2nd grade : ";
cin>>g2;
cout<<"enter 3rd grade : ";
cin>>g3;
float gpa=(g1+g2+g3)*1.0/3.0;
cout<<"Student's name : "<<stu_name<<endl;
cout<<"Average score : "<<gpa<<endl;
cout<<"Letter grade : "<<endl;
cout<<"gpa "<<gpa<<endl;
i=i+1;
}
return 0;
}
please provide what you implemented in project 1 and project 2 for letter grading. Then I will include that also.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.