-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCovid-Management-System.cpp
1336 lines (1304 loc) · 36.3 KB
/
Covid-Management-System.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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// COVID19 MANAGEMENT SYSTEM USING FILE HANDLING IN CPP - (Sagar Developer)
// HEADER FILES
#include <iostream>
#include <cstring>
#include <windows.h>
#include <fstream>
#include <conio.h>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <unistd.h>
#define TOTAL_VACCINE 400
using namespace std;
class covid_management
{
protected:
string username;
string password;
string usn;
int tm;
// FOR VACCINE CENTER
string center1 = "1center";
string center2 = "2center";
string center3 = "3center";
int sum_vaccine_c1 = 0; // Center1 vaccine Dose
int sum_vaccine_c2 = 0; // Center2 vaccine Dose
int sum_vaccine_c3 = 0; // Center3 vaccine Dose
int add, center_no;
// For Doctor Details
string identification_id;
char specialization[100];
string center;
// For User and some Doctor Details
char name[100];
char gender[100];
int age;
string adhaar;
int c;
string phone_no, profession, address, vaccine_name;
int dose;
public:
void menu();
void admin();
void admin_password();
void user();
void user_password();
void valid(string str); // For Valid Username Or not
// For ADMIN
void add_vaccine_stock(); // 1
void display_vaccine_stock(); // 2
void show_patient_data(); // 4
void show_data(); // 4-a
void applied_vaccine(); // 5
void add_doctor(); // 6
void search_doctor_data(); // 7
void display_doctor_data(); // 8
void doctor_show_data(); // 8-a
void search_by_aadhar(); // 4-a(1)
void search_by_age(); // 4-a(2)
void search_by_profession(); // 4-a(3)
void search_by_gender(); // 4-a(4)
// FOR USER
void search_center(); // 1
void add_patient_data(); // 2
void patient_show_data(); // 3
void update_patient_data(); // 4
};
void covid_management::menu()
{
system("cls");
int choice;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
// MAIN MENU
cout << "\n\n\t\t -->> MAIN MENU <<--";
cout << "\n\n\t\t -->>1. ADMIN";
cout << "\n\t\t -->>2. USER";
cout << "\n\t\t -->>3. EXIT";
cout << "\n\n\t\tEnter Choice: ";
cin >> choice;
// CALLING RELEVANT FUNCTION AS PER CHOICE
switch (choice)
{
case 1:
admin();
break;
case 2:
user();
break;
case 3:
system("cls");
cout << "\n\n\t\t\t COVID19 MANAGEMENT SYSTEM - BY SAGAR DEVELOPER";
Sleep(10);
exit(0);
default:
cout << "\n\n\t\t\t Invalid Choice... Please Try Again....";
cout << "\n\n Press Any Key To Continue: ";
getch();
menu();
}
}
void covid_management::admin()
{
admin_password();
A:
system("cls");
int admin_choice;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
// ADMIN MENU OPTIONS
cout << "\n\n\t\t -->> ADMIN MENU <<--";
cout << "\n\n\t\t 1. Add Vaccine Stock";
cout << "\n\t\t 2. Show Vaccine Center";
cout << "\n\t\t 3. Show Vaccine Stock";
cout << "\n\t\t 4. Show Patient Data";
cout << "\n\t\t 5. Show Total Number Of Vaccines Applied";
cout << "\n\t\t 6. Add New Doctor Data";
cout << "\n\t\t 7. Search Doctor Data";
cout << "\n\t\t 8. Show Doctor Data";
cout << "\n\t\t 9. LOG OUT";
cout << "\n\n\t\tEnter Choice: ";
cin >> admin_choice;
switch (admin_choice)
{
case 1:
add_vaccine_stock();
goto A;
break;
case 2:
search_center();
goto A;
break;
case 3:
display_vaccine_stock();
goto A;
break;
case 4:
show_patient_data();
goto A;
break;
case 5:
applied_vaccine();
goto A;
break;
case 6:
add_doctor();
goto A;
break;
case 7:
search_doctor_data();
goto A;
break;
case 8:
display_doctor_data();
goto A;
break;
case 9:
menu();
default:
cout << "\n\n\t\t\t Invalid Choice... Please Try Again....";
cout << "\n\n Press Any Key To Continue: ";
getch();
goto A;
break;
}
}
// ADMIN LOGIN
void covid_management::admin_password()
{
system("cls");
char a_name[20];
char a_password[20];
int ch, i = 0, capt = 0, capta = 0;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t -->> LOGIN ADMIN <<--";
cout << "\n\n\t\tEnter Your Name: ";
cin >> a_name;
cout << "\n\t\tEnter Your Password: ";
while ((ch = getch()) != 13)
{
cout << "*";
a_password[i] = ch;
i++;
}
a_password[i] = '\0';
srand(time(0));
capt = rand();
cout << "\n\n\t\tCaptcha: " << capt;
cout << "\n\n\t\tEnter Valid Captcha: ";
cin >> capta;
if ((strcmp(a_name, "sagar") == 0) && (strcmp(a_password, "pr123j") == 0) && (capt == capta))
{
cout << "\n\n\n\t\t\t\t\t| Verfiying ADMIN |\n\t\t\t\t\t";
for (int a = 1; a < 8; a++)
{
Sleep(500);
cout << "...";
}
cout << "\n\nAccess Granted..\n\n";
system("PAUSE");
system("cls");
}
else
{
cout << "\n\n\n\t\t\t\t\t| Verfiying ADMIN |\n\t\t\t\t\t";
for (int a = 1; a < 8; a++)
{
Sleep(500);
cout << "...";
}
cout << "\n\nAccess Aborted...\n\n";
system("PAUSE");
system("cls");
menu();
}
}
// USER LOGIN
void covid_management::user()
{
user_password();
B:
system("cls");
int user_choice;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
// USER MENU OPTIONS
cout << "\n\n\t\t -->> USER MENU <<--";
cout << "\n\n\t\t 1. Search Vaccination Center";
cout << "\n\t\t 2. Apply For Vaccine First Dose";
cout << "\n\t\t 3. Show Details";
cout << "\n\t\t 4. Apply For Vaccine Second Dose";
cout << "\n\t\t 5. LOG OUT";
cout << "\n\n\t\tEnter Choice: ";
cin >> user_choice;
switch (user_choice)
{
case 1:
search_center();
goto B;
case 2:
add_patient_data();
goto B;
case 3:
patient_show_data();
goto B;
case 4:
update_patient_data();
goto B;
case 5:
menu();
default:
cout << "\n\n\t\tInvalid Choice.. Please Try Again..\n";
cout << "\n\nPress Any Key To Continue..";
getch();
goto B;
}
}
// USER REGISTRATION AND LOGIN
void covid_management::valid(string str) // Check Username is available or not
{
string dir, user;
ifstream file;
dir = str + ".txt";
file.open(dir.c_str());
if (!file.is_open() && file.fail())
{
return;
}
else
{
tm++;
if (tm == 3)
{
cout << "\nThis Username already exists\nPlease Try Again..";
file.close();
return;
}
cout << "\nThis Username already exists!";
cout << "\n\n\t\tCreate a Username: ";
cin >> usn;
valid(usn);
}
}
void covid_management::user_password()
{
system("cls");
char c;
int user_choice;
string fname, usern;
ofstream fileo;
ifstream filei;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t -->> USER SUB-MENU <<--";
cout << "\n\n\t\t 1. Create Account";
cout << "\n\t\t 2. Login";
cout << "\n\t\t 3. Back";
cout << "\n\t\tEnter Choice: ";
cin >> user_choice;
if (user_choice == 1)
{
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t -->> REGISTRATION USER <<--";
cout << "\n\n\t\tEnter Your Name: ";
cin.ignore();
getline(cin, username);
cout << "\n\t\tEnter Your Username: ";
cin >> usn;
tm = 0;
valid(usn);
if(tm >= 3)
{
// continue;
}
cout << "\n\t\tEnter Your password: ";
cin >> password;
fname = usn + ".txt";
fileo.open(fname.c_str());
fileo << usn << endl
<< username << endl
<< password << endl;
cout << "\nYou are successfully registered:)";
cout << "\n\nPress Any Key To Continue..";
Sleep(500);
getch();
fileo.close();
user();
}
else if (user_choice == 2)
{
system("cls");
string u_name, u_pass;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
// LOGIN USER
cout << "\n\n\t\t -->> LOGIN USER <<--";
cout << "\n\n\t\tEnter Your Username: ";
cin >> u_name;
cout << "\n\t\tEnter Your Password: ";
cin >> u_pass;
fname = u_name + ".txt";
filei.open(fname.c_str());
if (!filei.is_open() && filei.fail())
{
cout << "\nYou are not registered, please register before logging in.\n";
filei.close();
getch();
user_password();
}
getline(filei, usern);
getline(filei, u_pass);
if (u_name == usn && u_pass == password)
{
cout << "\nYou are successfully logged in:)";
cout << "\n\nPress Any Key To Continue..";
Sleep(500);
getch();
user();
}
}
else if (user_choice == 3)
{
menu();
}
else
{
cout << "\n\n\t\t\t Invalid Choice... Please Try Again....";
cout << "\n\n Press Any Key To Continue: ";
getch();
user_password();
}
}
//************ADMIN************
void covid_management::add_vaccine_stock()
{
A:
fstream file;
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> ADD VACCINE IN CENTER <<--";
cout << "\n\n\t\t1. " << center1 << "\t\t2. " << center2;
cout << "\n\n\t\t3. " << center3 << "\t\t4. BACK";
cout << "\n\t\tEnter Choice: ";
cin >> center_no;
switch (center_no)
{
case 1:
{
file.open("center1.txt", ios::app);
cout << "\n\t\t -->> For Center 1 <<--";
cout << "\n\tEnter Number Of Vaccines You Want To Add: ";
cin >> add;
sum_vaccine_c1 = sum_vaccine_c1 + add;
file << sum_vaccine_c1;
file.close();
cout << "\n\n\tVaccine In Center: " << sum_vaccine_c1;
cout << "\n\n\t\tSUCCESSFULLY ADDED VACCINES TO THE CENTER";
cout << "\n\n\nPress Any Key To Continue..";
getch();
goto A;
break;
}
case 2:
{
file.open("center2.txt", ios::app);
cout << "\n\t\t -->> For Center 2 <<--";
cout << "\n\tEnter Number Of Vaccines You Want To Add: ";
cin >> add;
sum_vaccine_c2 = sum_vaccine_c2 + add;
file << sum_vaccine_c2;
file.close();
cout << "\n\n\tVaccine In Center: " << sum_vaccine_c2;
cout << "\n\n\t\tSUCCESSFULLY ADDED VACCINES TO THE CENTER";
cout << "\n\n\nPress Any Key To Continue..";
getch();
goto A;
break;
}
case 3:
{
file.open("center3.txt", ios::app);
cout << "\n\t\t -->> For Center 3 <<--";
cout << "\n\tEnter Number Of Vaccines You Want To Add: ";
cin >> add;
sum_vaccine_c3 = sum_vaccine_c3 + add;
file << sum_vaccine_c3;
file.close();
cout << "\n\n\tVaccine In Center: " << sum_vaccine_c3;
cout << "\n\n\t\tSUCCESSFULLY ADDED VACCINES TO THE CENTER";
cout << "\n\n\nPress Any Key To Continue..";
getch();
goto A;
break;
}
case 4:
break;
default:
cout << "\n\n\t\t\t Invalid Choice... Please Try Again....";
cout << "\n\n Press Any Key To Continue: ";
getch();
add_vaccine_stock();
break;
}
}
void covid_management::search_center()
{
system("cls");
ifstream file;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> Various Vaccination Centers In Your City <<--";
file.open("center1.txt");
if (!file)
{
cout << "\nFile Not Found ";
}
else
{
file >> sum_vaccine_c1;
cout << "\n\n\t\t-->> " << center1 << " <<--";
cout << "\n\t\tTotal Vaccine: " << sum_vaccine_c1;
}
file.close();
file.open("center2.txt");
if (!file)
{
cout << "\nFile Not Found ";
}
else
{
file >> sum_vaccine_c2;
cout << "\n\n\t\t-->> " << center2 << " <<--";
cout << "\n\t\tTotal Vaccine: " << sum_vaccine_c2;
}
file.close();
file.open("center3.txt");
if (!file)
{
cout << "\nFile Not Found ";
}
else
{
file >> sum_vaccine_c3;
cout << "\n\n\t\t-->> " << center3 << " <<--";
cout << "\n\t\tTotal Vaccine: " << sum_vaccine_c3;
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
}
void covid_management::display_vaccine_stock()
{
system("cls");
ifstream ind;
fstream file1, file2, file3;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t->> Available Vaccine Stock <<--\n\n";
int i = 0;
file1.open("center1.txt"); // Open Center1
file2.open("center2.txt"); // Open Center2
file3.open("center3.txt"); // Open Center3
file1 >> sum_vaccine_c1;
file2 >> sum_vaccine_c2;
file3 >> sum_vaccine_c3;
ind.open("Patient_Data.dat"); // Data take from Patient file
ind.seekg(0, ios::beg);
while (ind.read((char *)this, sizeof(covid_management)))
;
{
i++;
}
ind.close();
int s = TOTAL_VACCINE + sum_vaccine_c1 + sum_vaccine_c2 + sum_vaccine_c3 - i;
file1.close();
file2.close();
file3.close();
cout << "\n\nAvailable Number Of Vaccines are: " << s;
cout << "\n\nPress Any Key To Continue..";
getch();
}
void covid_management::add_doctor()
{
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> ADD DOCTOR <<--";
fstream file;
cout << "\n\n\t\tEnter Name: ";
fflush(stdin);
cin.getline(name, 100);
cout << "\n\n\t\tEnter Identification Number: ";
fflush(stdin);
cin >> identification_id;
C:
cout << "\n\n\t\tEnter Aadhar No.: ";
cin >> adhaar;
if (adhaar.length() != 12)
{
cout << "\nInvalid Aadhar Card Number";
goto C;
}
else
{
// The first letter should not start with 0 or 1
if (adhaar[0] == '0' || adhaar[0] == '1')
{
cout << "\nInvalid Aadhar Card Number";
goto C;
}
else
{
cout << "\nValid Aadhar Card Number";
}
}
B:
cout << "\n\n\t\tEnter Your Mobile Number: ";
cin >> phone_no;
if (phone_no.length() != 10)
{
cout << "\nInvalid Phone Number";
goto B;
}
else
{
// The First letter should not start with 0 or 1
if (phone_no[0] == '0' || phone_no[0] == '1')
{
cout << "\nInvalid Phone Number";
goto B;
}
else
{
cout << "\nValid Phone Number";
}
}
cout << "\n\n\t\tEnter Gender (M/F): ";
cin >> gender;
cout << "\n\n\t\tEnter Age: ";
cin >> age;
cout << "\n\n\t\tEnter Specialization: ";
fflush(stdin);
cin.getline(specialization, 40);
cout << "\n\n\t\tEnter Center Allotted: ";
cin >> center;
file.open("Doctor_Data.dat", ios::app | ios::binary);
file.write((char *)this, sizeof(covid_management));
cout << "\n\nYOUR DATA HAS BEEN SUCCESSFULLY INSERTED" << endl;
cout << "\n\nPress Any Key To Continue..";
file.close();
getch();
}
void covid_management::display_doctor_data()
{
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SHOW DOCTOR DATA <<--";
ifstream file;
file.open("Doctor_Data.dat", ios::in | ios::binary);
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(*this));
while (!file.eof())
{
cout << "\n";
doctor_show_data();
file.read((char *)this, sizeof(*this));
}
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
}
void covid_management::doctor_show_data()
{
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Name: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << name;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Identification No.: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << identification_id;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Aadhar No.: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << adhaar;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Mobile No.: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << phone_no;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Gender: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << gender;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Age: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << age;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Specialization: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << specialization;
cout.setf(ios::left, ios::adjustfield);
cout.width(20);
cout << endl
<< "Center Allotted: ";
cout.setf(ios::right, ios::adjustfield);
cout.width(25);
cout << setfill(' ') << center;
}
void covid_management::search_doctor_data()
{
B:
system("cls");
int choice;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH DOCTOR DATA <<--";
cout << "\n\t\t1. Search Data By Aadhar \t\t\t2. Search Data BY Identification ID" << endl;
cout << "\n\t\t3. Search Data By Center \t\t\t4. Search Data By Gender" << endl;
cout << "\n\t\t5. EXIT";
cout << "\n\n\t\tEnter Choice: ";
cin >> choice;
switch (choice)
{
case 1:
{
int count = 0;
string sadhaar;
ifstream file;
file.open("Doctor_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH DOCTOR DATA BY AADHAR <<--";
cout << "\n\n\t\tEnter Aadhar No.: ";
cin >> sadhaar;
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(covid_management));
}
while (!file.eof())
{
if (sadhaar.compare(adhaar) == 0)
{
count++;
doctor_show_data();
}
file.read((char *)this, sizeof(covid_management));
}
if (count == 0)
{
cout << "\nRecord Not Found!";
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
goto B;
}
case 2:
{
int count = 0;
string sidentification_id;
ifstream file;
file.open("Doctor_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH DOCTOR DATA BY Identification ID <<--";
cout << "\n\n\t\tEnter Identification ID: ";
cin >> sidentification_id;
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(covid_management));
}
while (!file.eof())
{
if (sidentification_id == identification_id)
{
count++;
doctor_show_data();
}
file.read((char *)this, sizeof(covid_management));
}
if (count == 0)
{
cout << "\nRecord Not Found!";
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
goto B;
}
case 3:
{
int count = 0;
string scenter;
ifstream file;
file.open("Doctor_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH DOCTOR DATA BY CENTER <<--";
cout << "\n\n\t\tEnter Center: ";
cin >> scenter;
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(covid_management));
}
while (!file.eof())
{
if (scenter.compare(center) == 0)
{
count++;
doctor_show_data();
}
file.read((char *)this, sizeof(covid_management));
}
if (count == 0)
{
cout << "\nRecord Not Found!";
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
goto B;
}
case 4:
{
int count = 0;
char sgender[10];
ifstream file;
file.open("Doctor_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH DOCTOR DATA BY GENDER <<--";
cout << "\n\n\t\tEnter Gender: ";
cin >> sgender;
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(covid_management));
}
while (!file.eof())
{
if (strcmp(sgender, gender) == 0)
{
count++;
doctor_show_data();
}
file.read((char *)this, sizeof(covid_management));
}
if (count == 0)
{
cout << "\nRecord Not Found!";
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
goto B;
}
case 5:
break;
default:
cout << "\n\n\t\tInvalid Choice.. Please Try Again..";
getch();
break;
goto B;
}
}
void covid_management::applied_vaccine()
{
ifstream ind;
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> VACCINATED PERSON <<--";
int i = 0;
ind.open("Patient_Data.dat");
ind.seekg(0, ios::beg);
while (ind.read((char *)this, sizeof(covid_management)))
{
i++;
}
ind.close();
cout << "\n\n\t\tVaccinated Person: " << i;
cout << "\n\nPress Any Key To Continue..";
getch();
}
void covid_management::show_patient_data()
{
B:
system("cls");
int choice;
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH PATIENT DATA <<--";
cout << "\n\t\t1. Search Data By Aadhar \t\t\t2. Search Data BY AGE" << endl;
cout << "\n\t\t3. Search Data By Profession \t\t\t4. Search Data By Gender" << endl;
cout << "\n\t\t5. EXIT";
cout << "\n\n\t\tEnter Choice: ";
cin >> choice;
switch (choice)
{
case 1:
search_by_aadhar();
goto B;
case 2:
search_by_age();
goto B;
case 3:
search_by_profession();
goto B;
case 4:
search_by_gender();
goto B;
case 5:
break;
default:
cout << "\n\n\t\tInvalid Choice.. Please Try Again..";
getch();
goto B;
}
}
void covid_management::search_by_aadhar()
{
int count = 0;
string sadhaar;
ifstream file;
file.open("Patient_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";
cout << "\n\t\t\t\t * COVID19 MANAGEMENT SYSTEM *";
cout << "\n\t\t\t\t*****************************************";
cout << "\n\n\t\t-->> SEARCH PATIENT DATA BY AADHAR <<--";
cout << "\n\n\t\tEnter Aadhar No.: ";
cin >> sadhaar;
if (!file)
{
cout << "\nFile Not Found!";
}
else
{
file.read((char *)this, sizeof(covid_management));
}
while (!file.eof())
{
if (sadhaar.compare(adhaar) == 0)
{
count++;
show_data();
}
file.read((char *)this, sizeof(covid_management));
}
if (count == 0)
{
cout << "\nRecord Not Found!";
}
file.close();
cout << "\n\nPress Any Key To Continue..";
getch();
}
void covid_management::search_by_age()
{
int count = 0;
int sage;
ifstream file;
file.open("Patient_Data.dat", ios::in | ios::binary);
system("cls");
cout << "\n\t\t\t\t*****************************************";