-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (52 loc) · 1.17 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (52 loc) · 1.17 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
#include <iostream>
#include <vector>
#include "Students.h"
#include "functions.h"
using namespace std;
int main()
{
vector<Student> students;
int choice;
// Load existing data
loadFromFile(students);
do
{
showMenu();
cin >> choice;
switch (choice)
{
case 1:
addStudent(students);
break;
case 2:
displayAllStudents(students);
break;
case 3:
searchStudent(students);
break;
case 4:
deleteStudent(students);
break;
case 5:
{
double avg = calculateAverage(students);
cout << "Average grade: " << avg << endl;
break;
}
case 6:
saveToFile(students);
break;
case 7:
loadFromFile(students);
break;
case 0:
cout << "Goodbye!\n";
break;
default:
cout << "Invalid choice!\n";
}
} while (choice != 0);
// Auto-save on exit
saveToFile(students);
return 0;
}