Enrollment system program

I'm making a program that simulates enrollment for students and teachers etc. In this program I should be able to add students, teachers and subjects. I'm done with adding the students, teachers and subjects, but I have no idea on how to let a teacher handle a specific subject and how to make a student enroll to subjects. Any help would be great. Here is my code by the way

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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#include <iostream>
#include <vector>
#include <string>
#include <conio.h>
#include <iomanip>

using namespace std;

struct subject {
	string name;
	string code;
	subject(string n, string c) : name(n), code(c) {}
};

struct student {
	string name;
	string id;
	vector<subject> subj;
	student(string n, string i) : name(n), id(i) {}
};

struct teacher {
	string name;
	string id;
	vector<subject> subj;
	teacher(string n, string i) : name(n), id(i) {}
};

vector<student> stud;
vector<teacher> teach;
vector<subject> subj;

void addStudent(){
	string name;
	string id;
	
	cout<<"Enter Name : ";
	getline(cin,name);
	cout<<"Enter id : ";
	getline(cin,id);
	
	stud.push_back(student(name,id));
}

void addTeacher(){
	string name;
	string id;
	
	cout<<"Enter Name : ";
	getline(cin,name);
	cout<<"Enter id : ";
	getline(cin,id);

	teach.push_back(teacher(name,id));
}

void addSubject(){
	string name;
	string code;
	
	cout<<"Enter Name : ";
	getline(cin,name);
	cout<<"Enter code : ";
	getline(cin,code);
	
	subj.push_back(subject(name,code));
}

void displayStudents(){
	if(stud.empty()==1){
		cout<<"No students"<<endl;
	}
	else{
		cout << left << setw(20) <<"Name";
		cout << left << setw(10) <<"ID"<<endl;
		cout<<"\n";
		for (vector<student>::iterator i = stud.begin(); i != stud.end(); i++) {
	      	  	cout << left << setw(20) <<i->name;
				cout << left << setw(10) <<i->id<<endl; 
	        }	
	}
}

void displayTeachers(){
	if(teach.empty()==1){
		cout<<"No teachers"<<endl;
	}
	else{
		cout << left << setw(20) <<"Name";
		cout << left << setw(10) <<"ID"<<endl;
		cout<<"\n";
		for (vector<teacher>::iterator i = teach.begin(); i != teach.end(); i++) {
	      	  	cout << left << setw(20) <<i->name;
				cout << left << setw(10) <<i->id<<endl; 
	        }
	}
}

void displaySubjects(){
	if(subj.empty()==1){
		cout<<"No subjects"<<endl;
	}
	else{
		cout << left << setw(20) <<"Name";
		cout << left << setw(10) <<"CODE"<<endl;
		cout<<"\n";
		for (vector<subject>::iterator i = subj.begin(); i != subj.end(); i++) {
	      	  	cout << left << setw(20) <<i->name;
				cout << left << setw(10) <<i->code<<endl; 
	        }
	}
}

void enrollSubject(){
	
}

void handleSubject(){
	
}

int main(){
	int ch;
	for(;;){
		cout<<"====================="<<endl;
		cout<<"[1] ADD STUDENT"<<endl;
		cout<<"[2] ADD TEACHER"<<endl;
		cout<<"[3] ADD SUBJECT"<<endl;
		cout<<"[4] ENROLL SUBJECT"<<endl;
		cout<<"[5] HANDLE SUBJECT"<<endl;
		cout<<"[6] DISPLAY STUDENTS"<<endl;
		cout<<"[7] DISPLAY TEACHERS"<<endl;
		cout<<"[8] DISPLAY SUBJECTS"<<endl;
		cout<<"====================="<<endl;
		cout<<"Enter choice : ";
		cin>>ch;
		cin.ignore();
		
		if(ch == 1){
			addStudent();
		}	
		else if(ch == 2){
			addTeacher();
		}
		else if(ch == 3){
			addSubject();
		}
		else if(ch == 4){
			enrollSubject();
		}
		else if(ch == 5){
			handleSubject();
		}
		else if(ch == 6){
			displayStudents();
		}
		else if(ch == 7){
			displayTeachers();
		}
		else if(ch == 8){
			displaySubjects();
		}
		else{
			break;
		}
		
		cout<<"\n\nPress any key to return to menu\n";
		getch();
		system("cls");
	}
}
Topic archived. No new replies allowed.