-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabase.cpp
More file actions
81 lines (68 loc) · 1.63 KB
/
Database.cpp
File metadata and controls
81 lines (68 loc) · 1.63 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <iostream>
#include <string>
#include "GradeItem.hpp"
#include "readFile.hpp"
#include "saveFile.hpp"
#include "display.hpp"
#include "addItem.hpp"
#include "searchItem.hpp"
#include "summary.hpp"
#include <vector>
using namespace std;
// menu function
void menu(){
//display menu
cout << "1. Read the file. " << endl;
cout << "2. Add new item to the file." << endl;
cout << "3. Search for an Item in the file."<< endl;
cout << "4. Save the grade item into a file." << endl;
cout << "5. Display list of grade items in screen. " << endl;
cout << "6. Dsiplay summery of grade items." << endl;
cout << "7. Exit" << endl;
cout << endl;
};
vector<GradeItem> v;
int main() {
//display menu
menu();
int choice;
string answer;
do{
cout << "Enter youre choice: ";
cin >> choice;
// using switch to choose between cases as they represent the needed funtions
switch (choice)
{
case 1:
readFile(v);
break;
case 2:
addItem(v);
break;
case 3:
searchItem(v);
break;
case 4:
saveFile();
break;
case 5:
display(v);
break;
case 6:
gradeSummary(v);
break;
default:
cout << "Invalid! please choose between 1-6."<< endl;
break;
}
cout << "\nPress 'y' to go back to menu or anykey to end the program: ";
cin >> answer;
// if y go back to menu
if (answer == "y" ){
menu();
}else{
break;
}
} while ( answer == "y" );
return 0;
};