ASSIGNMENT 2: Using a loop and a storage variable, output a text
file with the Student, Exam, and Part values lined up in a column.
Example of output:
Student Exam Part Score
1 1 1 7.5
We are going to have 4 students. Let's say that they're taking the SAT or some equally horrid national standardized exam that verifies how good you are at knowing their tricks. We're going to go with a 3 part exam. (Math, Verbal, Writing (Yes I know the NEW NEW SAT has taken writing out again.)) We're going to say that the students, unhappy with their scores, took it 3 times.
So here we go:
- The First student got 580 Math, 620 Verbal, 620 Writing on the first attempt.
610 Math, 610 Verbal, 630 Writing on the second attempt.
680 Math, 660 Verbal, 650 Writing on the third attempt.
- The Second student got 480 Math, 700 Verbal, 720 Writing on the first attempt.
530 Math, 710 Verbal, 740 Writing on the second attempt.
650 Math, 700 Verbal, 750 Writing on the third attempt.
- The Third student got 780 Math, 470 Verbal, 450 Writing on the first attempt.
760 Math, 600 Verbal, 540 Writing on the second attempt.
780 Math, 620 Verbal, 540 Writing on the third attempt.
- The Fourth student got 720 Math, 720 Verbal, 720 Writing on the first attempt.
710 Math, 750 Verbal, 790 Writing on the second attempt.
800 Math, 760 Verbal, 750 Writing on the third attempt.
Also, if you want to ask why the fourth student opted to retake the SAT with those scores, I'm going to suggest either overachiever or pressured by family.
Template:
#include <iostream>
using namespace std;
int main()
{
const int students = 2;
const int exams = 3;
const int parts = 2;
double scores[students][exams][parts];
for(int i = 0; i < students; i++)
{
for(int j = 0; j < exams; j++)
{
for(int k = 0; k < parts; k++)
{
cout << "Input score for student " << i+1 << " on exam " << j+1 << " for part " << k+1 << endl;
cin >> scores[i][j][k];
}
}
}