Question: I NEED FLOWCHART FOR THIS CODE....... #include #include using namespace std; int main() { int numStudents, numTests; double total, average; // Number of students //
I NEED FLOWCHART FOR THIS CODE.......
#include
#include
using namespace std;
int main()
{
int numStudents,
numTests;
double total,
average;
// Number of students
// Number of tests per student // Accumulator for total scores // Average test score
// Set up numeric output formatting.
cout << fixed << showpoint << setprecision(1);
// Get the number of students.
cout << "This program averages test scores. ";
cout << "For how many students do you have scores? ";
cin >> numStudents;
// Get the number of test scores per student.
cout << "How many test scores does each student have? ";
cin >> numTests;
// Determine each student's average score.
for (int student = 1; student <= numStudents; student++)
{
total = 0; // Initialize the accumulator.
for (int test = 1; test <= numTests; test++)
{
double score;
cout << "Enter score " << test << " for ";
cout << "student " << student << ": ";
cin >> score;
total += score;
}
average = total / numTests;
cout << "The average score for student " << student;
cout << " is " << average << ". ";
}
return 0;
}
This program averages test scores.
For how many students do you have scores? 2
How many test scores does each student have? 3
Enter score 1 for student 1: 84
Enter score 2 for student 1: 79
Enter score 3 for student 1: 97
The average score for student 1 is 86.7.
Enter score 1 for student 2: 92
Enter score 2 for student 2: 88
Enter score 3 for student 2: 94
The average score for student 2 is 91.3.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
