I'm having an extremely hard time with my code. I must Write a program that can be used to determine grades at the end of the semester.
For each student, who is identified by an integer number between 1 and 60, four examination grades
must be kept. Additionally, two final grade averages must be computed. The first grade average is
simply the average of all four grades. The second grade average is computed by weighting the four
grades as follows: the first grade gets a weight of 0.2, the second grade gets a weight of 0.3, the third
grade a weight of 0.3, and the fourth grade a weight of 0.2; that is computed as:
0.2 * grade1 + 0.3 * grade2+ 0.3* grade3 + 0.2 * grade4
Using this information, you are to construct a 60 X 7 two dimensional array, in which the first column
is used for the student number, the next four columns for the grades, and the last two columns for the
computed final grades. The output of the program should be a display of the data in a completed array.
Im having a hard time trying to assign the test grades to the table and dont know to to computed up to 60 students test grades.
Plase any help will be appreciated.
Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
using namespace std;
int test1;
int test2;
int test3;
int test4;
void printarray(int[][60]);
int main()
{
cout << "Enter grade for test one: ";
cin >> test1;
cout << "Enter grade for test two: ";
cin >> test2;
cout << "Enter grade for test three: ";
cin >> test3;
cout << "Enter grade for test four: ";
cin >> test4;
cout << "Stdnt" << "\t" << "Grade1" << "\t" << "Grade2" << "\t" << "Grade3" << "\t" << "Grade4" << "\t" << "Avg1" << "\t" << "Avg2" << endl;
int a[60][7], row, col;
for (row = 0; row < 60; row++)
for (col = 0; col < 7; col++)
cin >> a[5][6];
while (test1 != -1)
{
cin >> test1;
}
cin.get();
return 0;
}
|