Create a program that a professor can use to displaya grade for any number of st
ID: 3685525 • Letter: C
Question
Create a program that a professor can use to displaya grade for any number of students. Each student's grade is based on 4 tests with each test worth 100 points. The program should total the students test scores and then assign apprriopate grade 372-400 A 340-371 B 280-339 C Please use C++ repetition structure no functions, no dimensional array.
Please use this
int score = 0; int totalScore= 0; int test =0; char grade =' '; int student = 0; cout << " Please enter how many students to calculate? :"; cin >> student; for ( student=1; student> 1; student +=1) { cout << " Enter student number: " << student +1 << endl; cin >> student; } for (test=1; test<5; test +=1) { cout << "Enter number of test: " <> test; totalScore += test; }
Explanation / Answer
#include<iostream>
int main()
{
int score = 0; int totalscore= 0; int test =0; char grade =' '; int student = 0; int studentno;
cout << " Please enter how many students to calculate? :";
cin >> student;
for ( int i=0; i<student; i++)
{
cout << " Enter roll no of student "<<i+1<<": ";
cin >> studentno;
totalscore=0; score=0;
for (int j=0;j<4;j++)
{
cout << "Enter score of test "<<j+1 <<" for student "<<i+1<< ": ";
cin >>score;
totalscore+=score;
}
if(totalscore>=372 && totalscore<=400)
grade='A';
else if(totalscore>=340 && totalscore<=371)
grade='B';
else if(totalscore>=280 && totalscore<=339)
grade='C';
else grade='D';
cout <<"Student "<<i+1 <<": Total score "<< totalscore<< " and grade "<< grade<< endl;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.