-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
222 lines (177 loc) · 6.69 KB
/
Copy pathmain.cpp
File metadata and controls
222 lines (177 loc) · 6.69 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*******************************
Class Main
Implemented by Mohammad Hamka Izzuddin Bin Mohamad Yahya (73571)
*****************************/
/*Class Main implementation file*/
#include <iostream> // it is an object-oriented library that provides input & output function using streams
#include <string> // for string
#include <stdlib.h>
#include <windows.h> //windows.h is a Windows-specific header file, this header file contains declarations for all of the functions in the Windows API
#include <iomanip> //header file that helps us in manipulating the output of any C++ program
#include <conio.h> //header file used mostly by MS-DOS compilers to provide console input/output
#include <string.h> //header file used for string handling
#include <stdio.h> // a file which contain declaration of many functions and Macros which required to get input from input devices and show output on output screen of C Program
#include <limits> //this header file determines various properties of the various variable types
#define WINWIDTH 113 //used for welcome function
#define WINHEIGHT 15 //used for welcome function
/*Header files*/
#include "user.h"
#include "patient.h"
#include "doctor.h"
#include "hospital.h"
using namespace std;
//method/function declaration to welcome the user
void filler();
void liner();
void welcome();
//function for main menu and patient menu
void mainMenu();
void menuPatient();
//Classes uses to access other file
Patient pat;
Doctor doc;
User u;
Hospital h;
//main functiom
int main()
{
welcome();
cout << "\n\n\n\n\t\t\t\t\t Press Enter to continue"; //Please press the enter button to go to the main menu
getch(); //feedback to change page
system("CLS");
cout<<"\n==================================================================";
cout << " \n\t\tSMART HEALTH CONSULTING SYSTEM " << endl;
cout<<"==================================================================\n";
cout << "\n Program author: " << endl;
cout << " 1) Azreen Shafieqah binti Asri (74251)" << endl;
cout << " 2) Mohammad Hamka Izzudin bin Mohammad Yahya (73571) " << endl;
cout << " 3) Mohammad Amir Alam bin Rahim Omar (73563) " << endl;
cout << " 4) Nurulain Basirah binti Hamid (73779) " << endl;
cout << " 5) Iman Tarmizi Rosalina (73496) " << endl;
cout << "\n";
system(" pause");
mainMenu();
return 0;
}
//main menu for patient, doctor and hospital
void mainMenu(){
char option = '0';
system("cls");
system("Color F0");
cout << "=====================================================" << endl;
cout << " SMART HEALTH CONSULTING SYSTEM (Main Menu) " << endl;
cout << "=====================================================" << endl;
cout << " 1) Login as a Doctor " << endl;
cout << " 2) Login as a Patient" << endl;
cout << " 3) Login as a Hospital Administrator" << endl;
cout << " 4) Exit from System " << endl;
cout << "=====================================================" << endl;
cout << endl;
cout << " Enter your option (1/2/3/4)";
cout << "\n >> ";
cin >> option;
switch(option)
{
case '1':
/*Proceed to admin login page*/
doc.login();
mainMenu();
break;
case '2':
/*Proceed to patient login page*/
menuPatient();
mainMenu();
break;
case '3':
/*Proceed to hospital login page*/
h.login();
mainMenu();
break;
case '4':
/*Terminate the program*/
system("cls");
cout << "\n\n Thank you for using Smart Health Consulting System ." << endl;
exit(0);
default:
/*When user enter invalid key, program will refresh*/
mainMenu();
}//end switch option
}//end void mainMenu
//let patient choose to register or log in
void menuPatient(){
fflush (stdin);
char patOption = '0';
system ("cls");
system("Color F0");
cout << "=====================================================" << endl;
cout << " SMART HEALTH CONSULTING SYSTEM (Patient Login) " << endl;
cout << "=====================================================" << endl;
cout << " 1) Register as new patient " << endl;
cout << " 2) Login as existing patient" << endl;
cout << " 3) Return to Main Menu " << endl;
cout << "=====================================================" << endl;
cout << endl;
cout << " Please enter your option (1/2/3)";
cout << "\n >> ";
cin >> patOption;
switch(patOption)
{
case '1':
pat.registration();
menuPatient();
break;
case '2':
pat.login();
menuPatient();
break;
case '3':
return;
default:
menuPatient();
}
}
//filler method/function definiton
void filler()
{
//for loop
for(int i = 0 ; i < WINWIDTH ; i++) //with initialization of i = 0, and condition that winwidth is more than i, and incremented of i
{
cout << "*";
}
cout << "\a" << endl;
} //end of filler method/function
//liner method/function definition
void liner()
{
//body of liner method/function
for(int i = 0 ; i < WINHEIGHT ; i++)
cout << endl;
} //end of liner method/function
// Method/function definition used to welcome the user
void welcome()
{
//body of welcome method/function
system("Color F0");
liner(); // system will go to the liner function/method definition then back to the welcome function
cout << "Loading..." << endl; //this output will be displayed before the welcoming page
Sleep(500); //suspends the execution of the program for a specified period of time
system("Color F0");
//variable declaration
char msg[] = "WELCOME TO SMART HEALTH CONSULTING SYSTEM"; //this message will be displayed in welcome page
int len = strlen(msg);
int x;
x = (WINWIDTH/2) - (len/2); //x value calculation
//for loop
for(int i = 0 ; i < WINWIDTH ; i++) //with initialization of i = 0, and condition that winwidth is more than i, and incremented of i
{
//body of loo[
printf("%c",177);
Sleep(55); //suspends the execution of the program for a specified period of time
} //end for loop
cout << endl;
system("CLS"); //change page to the welcome page
liner(); // system will go to the liner function/method definition then back to the welcome function
filler(); // system will go to the filler function/method definition then back to the exit function
cout << setw(len+x) << msg << endl; //an output will be displayed
filler(); // system will go to the filler function/method definition then back to the welcome function
} //end of welcome method/function defintion