-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
180 lines (172 loc) · 5.96 KB
/
main.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
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
172
173
174
175
176
177
178
179
180
#include <iostream>
#include <cstring>
#include <bits/stdc++.h>
#include "Patient.h"
#include "Faculty.h"
#include "DoctorsOffice.h"
#include "OfficeOfAccounts.h"
#include "Pharmacy.h"
#define DOCTOR 1
#define HCSTAFF 2
#define STUDENT 1
#define NO 0
#define YES 1
void LOGINSTART()
{
int repeat = YES; int incorrectChoice1 = NO;
do
{
int choice;
std::cout << "\n\n\t***IIT Jodhpur Health Center Management System***\n\n";
std::cout << "How do you wish to login? (Enter the coorresponding number):\n";
std::cout << " 1: Patient\n";
std::cout << " 2: Faculty\n";
std::cout << " 3: Doctor's Office\n";
std::cout << " 4: Office of Accounts\n";
// std::cout << " 5: Office of Academics\n";
std::cout << " 5: Pharmacy\n";
std::cout << "Your choice - ";
std::cin >> choice;
switch(choice)
{
case 1: //login for Patients
{
int repeat = YES, incorrectChoice = NO;
do
{
int subchoice;
std::cout << "\nYou wish to login as? (Enter the corresponding number):\n";
std::cout << " 1: Student\n";
std::cout << " 2: Faculty\n";
std::cout << " 3: Staff\n";
std::cout << "Your choice - ";
std::cin >> subchoice;
switch(subchoice)
{
case 1:
{
student::login(1); //students as patients
break;
}
case 2:
{
faculty::login(2); //faculty as patients
break;
}
case 3:
{
staff::login(3); //staff as patients
break;
}
default:
{
std::cout << "Please enter a valid option!\n";
incorrectChoice = YES;
}
}
if(incorrectChoice == YES)
repeat = YES;
else
{
std::cout << "\nDo you wish to login as patient again? (Yes/No): ";
std::string response;
std::cin >> response;
std::transform(response.begin(), response.end(), response.begin(), ::tolower);
if(response.std::string::compare("yes")==0)
{
repeat = YES;
}
else repeat = NO;
}
} while(repeat == YES);
break;
}
case 2: // login for Faculty
{
Faculty::login();
break;
}
case 3: // Login for Doctor's Office
{
//DoctorsOffice::PreLoadStuff()
int repeat = YES, incorrectChoice = NO;
do
{
int subchoice;
std::cout << "You wish to login as? (Enter the corresponding number)\n";
std::cout << " 1: Doctor\n";
std::cout << " 2: Staff\n";
std::cout << "Your choice - ";
std::cin >> subchoice;
switch(subchoice)
{
case 1: //Login as Doctor
{
Doctor::login(DOCTOR); //login mode is a doctor
break;
}
case 2: // Login as HC Staff
{
HCstaff::login(HCSTAFF);
break;
}
default:
{
std::cout << "Please enter a valid option!\n";
incorrectChoice = YES;
}
}
if(incorrectChoice == YES)
repeat = YES;
else
{
std::cout << "Do you wish to login from Doctors' Office again? (Yes/No): ";
std::string response;
std::cin >> response;
std::transform(response.begin(), response.end(), response.begin(), ::tolower);
if(response.std::string::compare("yes")==0)
{
repeat = YES;
}
else repeat = NO;
}
} while(repeat==YES);
break;
}
case 4: //Login for Office Of Accounts
{
OfficeOfAccounts::login();
break;
}
case 5: //Login for Pharmacys
{
Pharmacy::login();
break;
}
default:
{
std::cout << "Please enter a valid option!\n";
incorrectChoice1 = YES;
}
}
if(incorrectChoice1==YES)
repeat = YES;
else
{
std::cout << "Do you wish to re-run the program? (Yes/No): ";
std::string response;
std::cin >> response;
std::transform(response.begin(), response.end(), response.begin(), ::tolower);
if(response.std::string::compare("yes")==0)
{
repeat = YES;
}
else repeat = NO;
}
}while(repeat == YES);
}
int main()
{
DoctorsOffice::PreLoadStuff();
LOGINSTART();
}