Hi shadowCODE, I guess i haven't been super specific, this thing is kicking my butt.
But the prof wants us to use multidimensional arrays. (some 2d, and a 3d) and i have one input file, with data for 3 students with their name, address, id number, telephone number, social, age, and years attended, and then 3 courses with 5 test grades, that looks like this:
Student Grade Sheet
John Doe
A01234567
1234 Right drive, Yellowtown, TX 73452
(281) 234 9876
123-45-6789
CS1428
CS2308
CS3002
24
1
90.9
94.2
98.5
89.8
97.7
82.1
83.5
98.2
87.4
92.1
56.3
90.3
95.3
45.7
12.1
Student Grade Sheet
Jane Smith
A09876543
123 S. Road Dr., Bluebonnet, TX 72345
(512) 546 2345
100-45-6789
CS1000
CS2000
CS4000
19
2
86.3
90.3
95.3
75.7
82.1
98.0
76.4
78.0
75.4
90.2
37.5
83.2
33.4
47.1
93.7
Student Grade Sheet
Joe Blogs
A07894561
1900 E. Parkway Dr., Austin, TX 78744
(210) 987 3242
123-45-2345
CS5000
CS6000
CS7000
21
3
80.9
90.2
98.5
89.8
97.7
99.3
100
98.2
97.4
99.1
95.4
92.1
87.4
78.6
77.5
The names you see in the [] when i declare the arrays are just named constants that hold a number ( for example, [StudentNum] is the same as [3] since i declared that StudentNum = 3 earlier on).
he wants the output file to look something like this:
Student Grade Sheet
Name of Student: John Doe
Age: 24
Address: 1234 Right drive, Yellowtown, TX 73452
Number of years at Texas State: 1
Telephone Number: (281) 234 9876
Student Soc. Security #: 123-45-6789
Course Number: CS1428
Test #1: 90.9
Test #2: 94.2
Test #3: 98.5
Test #4: 89.8
Final Exam: 97.7
Numerical Grade in CS1428: 95.0
Letter Grade in CS1428: A
Appreciation Note: Congratulations, Your performance is excellent!
Currently, i have gotten my loops this far:
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 38 39 40 41
|
for (int a = 0; a < StudentNum; a++)
{
for (int b = 0; b < NonNumData; b++)
{
getline(fin,studentStringData[a][b]);
if (studentStringData[a][b].length() <= 1)
{
cout << "Student Data is incorrect.\n";
continue;
}
fout << studentStringData[a][b] << endl;
}
for (int c = 0; c < NumData; c++)
{
fin >> studentNumData[a][c];
if (studentNumData[a][c] < 1 || studentNumData[a][c] > 100)
{
cout << "Student Data is incorrect.\n";
break;
}
fout << studentNumData[a][c] << endl;
}
for (int d = 0; d < NumCourses; d++)
{
for (int e = 0; e < 5; e++)
{
fin >> studentGrades[a][d][e];
fin.ignore();
if (studentGrades[a][d][e] < 1 || studentGrades[a][d][e] > 100)
{
cout << "Student Data is incorrect.\n";
break;
}
fout << studentGrades[a][d][e] << endl;
}
studentGrades[a][d][5] = (studentGrades [a][d][0] * test1Percentage) + (studentGrades [a][d][1] * test23Percentage) +
(studentGrades [a][d][2] * test23Percentage) + (studentGrades [a][d][3] * test4Percentage) + (studentGrades [a][d][4] * examPercentage);
fout << studentGrades[a][d][5] << endl;
}
}
|
and my output looks like this:
Student Grade Sheet
John Doe
A01234567
1234 Right drive, Yellowtown, TX 73452
(281) 234 9876
123-45-6789
CS1428
CS2308
CS3002
24
1
90.9
94.2
98.5
89.8
97.7
95.035
82.1
83.5
98.2
87.4
92.1
89.785
56.3
90.3
95.3
45.7
12.1
47.45
Student Grade Sheet
Jane Smith
A09876543
123 S. Road Dr., Bluebonnet, TX 72345
(512) 546 2345
100-45-6789
CS1000
CS2000
CS4000
19
2
86.3
90.3
95.3
75.7
82.1
84.45
98
76.4
78
75.4
90.2
84.12
37.5
83.2
33.4
47.1
93.7
68.14
Student Grade Sheet
Joe Blogs
A07894561
1900 E. Parkway Dr., Austin, TX 78744
(210) 987 3242
123-45-2345
CS5000
CS6000
CS7000
21
3
80.9
90.2
98.5
89.8
97.7
93.435
99.3
100
98.2
97.4
99.1
98.78
95.4
92.1
87.4
78.6
77.5
83.185