-
Notifications
You must be signed in to change notification settings - Fork 0
/
source
62 lines (52 loc) · 1.06 KB
/
source
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int v;
double enter;
vector<string> names;
string n;
vector<double> grades;
vector<vector<double>> base;
for (int i = 0; i < 5; i++)
{
cout << "Enter student #" << (i + 1) << "'s name ==> ";
cin >> n;
names.push_back(n);
for (int p = 0; p < 5; p++)
{
cout << n << "'s grade #" << (p + 1) << "==> ";
cin >> enter;
grades.push_back(enter);
}
base.push_back(grades);
grades.clear();
cout << endl;
cout << endl;
}
double accum = 0;
cout << "GRADE BOOK UPDATED \n";
cout << "============================" << endl << endl;
vector<string> header = { "Grade" , "Average" };
for (int h = 0; h < 5; h++)
{
cout << "\t" << header[0] << " #" << (h + 1);
}
cout << "\t" << header[1];
cout << endl;
for (int o = 0; o < 5; o++)
{
cout << names[o];
for (int n = 0; n < 5; n++)
{
cout << "\t\t" << base[o][n];
accum = base[n][o] + accum;
}
accum = accum / 5;
cout << "\t" << accum;
accum = 0;
cout << endl;
}
cout << "Saved! \n \n";
}