-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputOutput.cpp
125 lines (102 loc) · 2.75 KB
/
InputOutput.cpp
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
#include "InputOutput.h"
#include <vector>
#include <iostream>
#include "myVector.h"
using namespace std;
myVector v;
void InputOutput::DisplayInstructor(){
if(v.insts.empty()){
cout<<"There is no instructor to shown"<<endl;
}
else{
for(int i =0; i<v.insts.size();i++){
cout<<endl;
cout<<i+1<<"- Name:"<<v.insts[i].getName()<<" Surname:"<<v.insts[i].getSurname();
cout<<" Age:"<<v.insts[i].getAge();
cout<<" Email:"<<v.insts[i].GetEmail();
cout<<endl;
}
}
}
void InputOutput::EraseInstructor(){
int removed;
if(v.insts.empty()){
cout<<"There is no instructor to erase..."<<endl;
}
else{
DisplayInstructor();
cout<<endl<<"Please enter your choice( will be deleted ):"<<endl;
cin>>removed;
v.insts.erase(v.insts.begin() + removed - 1);
cout<<endl<<"NEW LIST"<<endl;
DisplayInstructor();
}
}
void InputOutput::displayStudent(){
if(v.students.empty()){
cout<<"There is no student to display..."<<endl;
}
else{
for(int i =0; i<v.students.size();i++){
cout<<endl;
cout<<i+1<<"- Name:"<<v.students[i].getName()<<" Surname:"<<v.students[i].getSurname();
cout<<" Age:"<<v.students[i].getAge();
cout<<" Absence:"<<v.students[i].getAbsence();
cout<<" Id:"<<v.students[i].getId();
cout<<endl;
}
}
}
void InputOutput::EraseStudent(){
if(v.students.empty()){
cout<<"There is no student to erase..."<<endl;
}
else{
int removed;
displayStudent();
cout<<endl<<"Please enter your choice(will be deleted ):"<<endl;
cin>>removed;
v.students.erase(v.students.begin() + removed - 1);
cout<<endl<<"NEW LIST"<<endl;
displayStudent();
}
}
void InputOutput::AddInstructor(){
string Name,Surname,Email,lecture;
int Age;
cout<<"Name: ";
cin>>Name;
cout<<"Surname: ";
cin>>Surname;
cout<<"Email: ";
cin>>Email;
cout<<"Age: ";
cin>>Age;
Instructor instructors(Name,Surname,Age,Email);
v.insts.push_back(instructors);
cout<<"Please enter Lecture:"<<endl;
cin>>lecture;
instructors.AddLecture(lecture); // bu objeyi zatgen çaðýrdýk ve içini doldurduk
}
void InputOutput::AddStudent(){
string Name,Surname;
int Id, Absence,Age;
cout<<"Name: ";
cin>>Name;
cout<<"Surname: ";
cin>>Surname;
cout<<"Absence: ";
cin>>Absence;
cout<<"Id: ";
cin>>Id;
cout<<"Age: ";
cin>>Age;
if(Absence==0){
Student stu(Name,Surname,Age,Id);
v.students.push_back(stu);
}
else{
Student stu(Name,Surname,Age,Absence,Id);
v.students.push_back(stu);
}
}