-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.cpp
1055 lines (894 loc) · 27.4 KB
/
project.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
#include <iostream>
#include <fstream>
#include <vector>
#include <conio.h>
using namespace std;
struct testType{
string test_type;
string labName;
int startValue;
int endValue;
int unit;
};
struct location{
string city;
string street;
};
struct birthday{
int day;
int month;
int year;
};
struct patient {
int ID;
string first_name;
string last_name;
string gender;
string phoneNum;
location address;
int age;
};
struct medicine{
int ID;
string name;
int price;
};
struct clinic{
int ID;
string name;
int working_days;
};
struct doctor{
int ID;
string first_name;
string last_name;
birthday BD;
int clinicID;
};
ifstream fin;
ofstream fout;
void login();
void first_window();
void patients_window();
void patientDocument_window();
// ------------------patient operations------------------
bool checkPatientID(int ID , vector<patient> patientVec);
bool checkPatientFN(string first_name, vector <patient> patientVec);
bool checkPatientLN(string last_name, vector <patient> patientVec);
void loadPatient(vector <patient> &patientVec);
void printAllPatients(vector <patient> patientVec);
void addPatient(vector <patient> &patientVec);
void alterFile(vector <patient> &patientVec);
void deletePatient(vector <patient> &patientVec);
void editPatient(vector <patient> &patientVec);
void searchPatientID(vector <patient> patientVec);
void searchPatientFN(vector <patient> patientVec);
void searchPatientLN(vector <patient> patientVec);
// ------------------------------------------------------
void treatments_window();
void recipe_window();
void testResult_window();
void laboratory_window ();
void printCats();
void printTest();
void medicines_window();
void clinics_window();
void doctorsFiles_window();
bool checkDoctorID(int ID, vector<doctor> doctorVec);
void loadDoctor(vector<doctor> &doctorVec);
bool checkCatName(string labCat, vector <string> catVec);
void loadCat(vector<string> &catVec);
bool checkTestType(string test_type, vector <testType> testTypeVec);
void loadTestType(vector<testType> &testTypeVec);
bool checkMedID(int ID, vector <medicine> medVec);
void loadMedicine(vector <medicine> &medVec);
vector <patient> patientVec;
vector <string> catVec;
vector <doctor> doctorVec;
vector <testType> testTypeVec;
vector <medicine> medVec;
main()
{
login();
}
void login()
{
start: system("cls");
fin.open("login.txt");
string a,b;
fin>>a;
cout<<"Enter username: ";
cin>>b;
string x,y;
fin>>x;
cout<<"Enter password: ";
cin>>y;
fin.close();
fin.clear(); // to start from the beginning of file
if(a==b && x==y)
{
loadPatient(patientVec);
loadDoctor(doctorVec);
loadCat(catVec);
loadTestType(testTypeVec);
loadMedicine(medVec);
first_window();
}
else
{
goto start;
}
}
void first_window()
{
start: system("cls");
cout<<"1-Patients\n2-Laboratory\n3-Medicines\n4-Clinics\n5-Doctors file\n6-Exit\n";
int a;
cin>>a;
switch(a)
{
case 1: patients_window(); break;
case 2: laboratory_window(); break;
case 3: medicines_window(); break;
case 4: clinics_window(); break;
case 5: doctorsFiles_window(); break;
case 6: exit(1); break;
default: goto start; break;
}
}
void patients_window()
{
start: system("cls");
cout<<"1-Patient document\n2-Treatments\n3-Recipe\n4-Test Result\n5-Back\n";
int a;
cin>>a;
switch(a)
{
case 1: patientDocument_window(); break;
case 2: treatments_window(); break;
case 3: recipe_window(); break;
case 4: testResult_window(); break;
case 5: first_window(); break;
default: goto start; break;
}
}
void patientDocument_window()
{
start: system("cls");
cout<<"1-Patients information\n2-Add new patient\n3-Delete Patient *\n4-Edit patient info *\n5-Search by id\n6-Srarch by first name\n7-Search by last name\n8-Back\n";
int a;
cin>>a;
switch(a)
{
case 1: printAllPatients(patientVec); break;
case 2: addPatient(patientVec); break;
case 3: deletePatient(patientVec); break;
case 4: editPatient(patientVec); break;
case 5: searchPatientID(patientVec); break;
case 6: searchPatientFN(patientVec); break;
case 7: searchPatientLN(patientVec); break;
case 8: patients_window(); break;
default: goto start; break;
}
}
void treatments_window()
{
start: system("cls");
cout<<"Enter patient ID: ";
int pID;
cin>>pID; //then check if it exists
if(!checkPatientID(pID, patientVec))
{
cout<<"Patient doesn't exist. \nPress X to enter patient ID again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter doctor ID: ";
int dID;
cin>>dID; // then check if it exists
if(!checkDoctorID(dID, doctorVec))
{
cout<<"Doctor doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter lab category: ";
string labCat;
cin.ignore();
getline(cin,labCat); //then check if it exists
if(!checkCatName(labCat, catVec))
{
cout<<"Catagory doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter the test type: ";
string test_type;
getline(cin, test_type); //then check if it exists
if(!checkTestType(test_type, testTypeVec))
{
cout<<"Test Type doesn't exist doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter the date of the treatment: ";
string DATE;
getline(cin, DATE);
cout<<"Enter the diagnose information: ";
string diaInfo;
getline (cin, diaInfo);
fout.open("treatments.txt", ios::app);
fout<<"Patient ID: "<<pID<<"\nDoctor ID: "<<dID<<"\nLab catagory: "<<labCat<<"\nTest Type: "<<test_type<<"\nDate: "<<DATE<<"\nDagnose information: "<<diaInfo<<"\n\n";
fout.close();
//Then add all the pID & dID & labCat & testType & DATE & diaInfo to a file called treatments
patients_window();
}
void laboratory_window()
{
start: system("cls");
cout<<"1-Category\n2-Test type\n3-Back\n";
int a;
cin>>a;
switch(a)
{
case 1: printCats(); break;
case 2: printTest(); break;
case 3: first_window(); break;
default: goto start; break;
}
}
// -----------------------------patient operations----------------------------------
bool checkPatientID(int ID , vector<patient> patientVec)
{
for(int i=0; i< patientVec.size(); i++)
{
if(patientVec[i].ID==ID)
return true;
}
return false;
}
bool checkPatientFN(string first_name, vector<patient> patientVec)
{
for(int i=0; i<patientVec.size(); i++)
{
if(patientVec[i].first_name==first_name)
return true;
}
return false;
}
bool checkPatientLN(string last_name, vector<patient> patientVec)
{
for(int i=0; i<patientVec.size(); i++)
{
if(patientVec[i].last_name==last_name)
return true;
}
return false;
}
void printAllPatients(vector <patient> patientVec)
{
system("cls");
for(int i = 0; i < patientVec.size(); i++)
{
cout<<patientVec[i].ID<<" "<<patientVec[i].first_name<<" "<<patientVec[i].last_name<<" "
<<patientVec[i].gender<<" "<<patientVec[i].phoneNum<<" "<<patientVec[i].address.city<<" "
<<patientVec[i].address.street<<" "<<patientVec[i].age<<"\n\n";
}
char a;
cout<<"Press any button to go back";
if(a=getch())
{
patientDocument_window();
}
}
void loadPatient(vector<patient> &patientVec)
{
fin.clear();
fin.open("patient_info.txt");
if(!fin)
{
cerr<<"File doesn't exist."<<endl;
exit(EXIT_FAILURE);
}
int ID;
string first_name;
string last_name;
string gender;
string phoneNum;
location address;
int age;
for(int i=0; !fin.eof(); i++)
{
fin>>ID>>first_name>>last_name>>gender>>phoneNum>>address.city>>address.street>>age;
patient p;
p.ID=ID;
p.first_name=first_name;
p.last_name=last_name;
p.gender=gender;
p.phoneNum=phoneNum;
p.address.city=address.city;
p.address.street=address.street;
p.age=age;
patientVec.push_back(p);
}
fin.close();
}
void addPatient(vector <patient> &patientVec)
{
start: system("cls");
patient p;
cout<<"Enter patient ID: ";
cin>>p.ID;
if(checkPatientID(p.ID, patientVec))
{
cout<<"This ID already exists.\nPress X to enter ID again.";
char a=getch();
if(a=='x')
goto start;
else
patientDocument_window();
}
cout<<"\nEnter patient first name: ";
cin>>p.first_name;
cout<<"\nEnter patient last name: ";
cin>>p.last_name;
cout<<"\nEnter patient gender: ";
cin>>p.gender;
cout<<"\nEnter patient phone number: ";
cin>>p.phoneNum;
cout<<"\nEnter patient city: ";
cin>>p.address.city;
cout<<"\nEnter patient street: ";
cin>>p.address.street;
cout<<"\nEnter patient age: ";
cin>>p.age;
fout.open("patient_info.txt", ios::app);
fout<<p.ID<<" "<<p.first_name<<" "<<p.last_name<<" "<<p.gender<<" "<<p.phoneNum<<" "
<<p.address.city<<" "<<p.address.street<<" "<<p.age<<endl;
fout.close();
cout<<"\n\nPatient has been added.\nPress any key to go back.";
char a;
if(a=getch())
{
patientDocument_window();
}
}
void deletePatient(vector <patient> &patientVec)
{
system("cls");
cout<<"What's the ID of the patient you want to delete? ";
int ID;
cin>>ID;
if(checkPatientID(ID, patientVec))
{
for(int i=0; i < patientVec.size(); i++)
{
if(patientVec[i].ID==ID)
{
patientVec.erase(patientVec.begin()+i);
cout<<"deleted";
break;
}
}
alterFile(patientVec);
loadPatient(patientVec);
}
}
void editPatient(vector <patient> &patientVec)
{
start: system("cls");
cout<<"What's the ID of the patient you want to edit? ";
int ID;
cin>>ID;
if (checkPatientID(ID, patientVec))
{
patient s;
cout<<"Enter your new ID: ";
cin>>s.ID;
cout<<"Enter your new first name: ";
cin>>s.first_name;
cout<<"Enter your new last name: ";
cin>>s.last_name;
cout<<"Enter your new gender: ";
cin>>s.gender;
cout<<"Enter your new phone number: ";
cin>>s.phoneNum;
cout<<"Enter your new city: ";
cin>>s.address.city;
cout<<"Enter your new street: ";
cin>>s.address.street;
cout<<"Enter your new age: ";
cin>>s.age;
for(int i=0; i< patientVec.size(); i++)
{
if (patientVec[i].ID==ID)
{
patientVec.erase(patientVec.begin()+i);
patientVec.push_back(s);
break;
}
}
alterFile(patientVec);
}
else
{
cout<<"ID not found.\nPress X to enter ID again.\n";
char a= getch();
if(a=='x')
{
goto start;
}
}
patientDocument_window();
}
void searchPatientID(vector <patient> patientVec)
{
system("cls");
start: cout<<"What's the ID? ";
int ID;
cin>>ID;
if(checkPatientID(ID, patientVec))
{
for (int i=0; i<patientVec.size(); i++)
{
if(ID==patientVec[i].ID)
{
cout << "Id : "<<patientVec[i].ID<<endl
<< "First name : "<<patientVec[i].first_name<<endl
<< "Last name : "<<patientVec[i].last_name<<endl
<< "Gender : "<<patientVec[i].gender<<endl
<< "Phone : "<<patientVec[i].phoneNum<<endl
<< "City : "<<patientVec[i].address.city<<endl
<< "Street : "<<patientVec[i].address.street<<endl
<< "Age : "<<patientVec[i].age<<endl;
break;
}
}
}
else
{
cout<<"ID not found.\nPress X to enter ID again.\n";
char a= getch();
if(a=='x')
{
goto start;
}
}
char a;
cout<<"Press any key to go back.";
if(a=getch())
patientDocument_window();
}
void searchPatientFN(vector <patient> patientVec)
{
system("cls");
start: cout<<"What's the first name? ";
string first_name;
cin>>first_name;
if(checkPatientFN(first_name, patientVec))
{
for (int i=0; i<patientVec.size(); i++)
{
if(first_name==patientVec[i].first_name)
{
cout << "Id : "<<patientVec[i].ID<<endl
<< "First name : "<<patientVec[i].first_name<<endl
<< "Last name : "<<patientVec[i].last_name<<endl
<< "Gender : "<<patientVec[i].gender<<endl
<< "Phone : "<<patientVec[i].phoneNum<<endl
<< "City : "<<patientVec[i].address.city<<endl
<< "Street : "<<patientVec[i].address.street<<endl
<< "Age : "<<patientVec[i].age<<endl<<endl<<endl;
}
}
}
else
{
cout<<"ID not found.\nPress X to enter ID again.\n";
char a= getch();
if(a=='x')
{
goto start;
}
}
char a;
cout<<"Press any key to go back.";
if(a=getch())
patientDocument_window();
}
void searchPatientLN(vector <patient> patientVec)
{
system("cls");
start: cout<<"What's the last name? ";
string last_name;
cin>>last_name;
if(checkPatientLN(last_name, patientVec))
{
for (int i=0; i<patientVec.size(); i++)
{
if(last_name==patientVec[i].last_name)
{
cout << "Id : "<<patientVec[i].ID<<endl
<< "First name : "<<patientVec[i].first_name<<endl
<< "Last name : "<<patientVec[i].last_name<<endl
<< "Gender : "<<patientVec[i].gender<<endl
<< "Phone : "<<patientVec[i].phoneNum<<endl
<< "City : "<<patientVec[i].address.city<<endl
<< "Street : "<<patientVec[i].address.street<<endl
<< "Age : "<<patientVec[i].age<<endl<<endl<<endl;
}
}
}
else
{
cout<<"ID not found.\nPress X to enter ID again.\n";
char a= getch();
if(a=='x')
{
goto start;
}
}
char a;
cout<<"Press any key to go back.";
if(a=getch())
patientDocument_window();
}
void alterFile(vector <patient> &patientVec)
{
fout.open("patient_info.txt", ios::out);
for(int i=0; i < patientVec.size(); i++)
{
fout<<patientVec[i].ID<<" "<<patientVec[i].first_name<<" "<<patientVec[i].last_name<<" "<<patientVec[i].gender
<<" "<<patientVec[i].phoneNum<<" "<<patientVec[i].address.city<<" "<<patientVec[i].address.street<<" "
<<patientVec[i].age<<endl;
}
fout.close();
}
// ---------------------------------------------------------------------------------
void printCats()
{
system("cls");
fin.clear();
fin.open("cat.txt");
string a;
while(!fin.eof())
{
fin>>a;
cout<<a<<endl;
}
fin.close();
char b;
cout<<"\nPress any key to go back.";
if(b=getch())
first_window();
}
void printTest()
{
system("cls");
fin.clear();
fin.open("testType.txt");
testType a;
while(!fin.eof())
{
fin>>a.test_type>>a.labName>>a.startValue>>a.endValue>>a.unit;
cout<<a.test_type<<" "<<a.labName<<" "<<a.startValue<<" "<<a.endValue<<" "<<a.unit<<endl;
}
fin.close();
char b;
cout<<"\nPress any key to go back.";
if(b=getch())
first_window();
}
void medicines_window()
{
system("cls");
fin.clear();
fin.open("medicines.txt");
medicine a;
while(!fin.eof())
{
fin>>a.ID>>a.name>>a.price;
cout<<a.ID<<" "<<a.name<<" "<<a.price<<endl;
}
fin.close();
char b;
cout<<"\nPress any key to go back.";
if(b=getch())
first_window();
}
void clinics_window()
{
system("cls");
fin.clear();
fin.open("clinics.txt");
clinic a;
while(!fin.eof())
{
fin>>a.ID>>a.name>>a.working_days;
cout<<a.ID<<" "<<a.name<<" "<<a.working_days<<endl;
}
fin.close();
char b;
cout<<"\nPress any key to go back.";
if(b=getch())
first_window();
}
void doctorsFiles_window()
{
system("cls");
fin.clear();
fin.open("doctors.txt");
doctor a;
while(!fin.eof())
{
fin>>a.ID>>a.first_name>>a.last_name>>a.BD.day>>a.BD.month>>a.BD.year>>a.clinicID;
cout<<"ID: "<<a.ID<<"\nFirst name: "<<a.first_name<<"\nLast name: "<<a.last_name
<<"\nDay of birth: "<<a.BD.day<<"\nMonth of birth: "<<a.BD.month
<<"\nYear of birth: "<<a.BD.year<<"\nClinic : "<<a.clinicID<<"\n\n";
}
fin.close();
char b;
cout<<"\nPress any key to go back.";
if(b=getch())
first_window();
}
bool checkDoctorID(int ID, vector <doctor> doctorVec)
{
for(int i=0; i< doctorVec.size(); i++)
{
if(doctorVec[i].ID==ID)
return true;
}
return false;
}
void loadDoctor(vector<doctor> &doctorVec)
{
fin.clear();
fin.open("doctors.txt");
if(!fin)
{
cerr<<"File doesn't exist."<<endl;
exit(EXIT_FAILURE);
}
int ID;
string first_name;
string last_name;
birthday BD;
int clinicID;
for(int i=0; !fin.eof(); i++)
{
fin>>ID>>first_name>>last_name>>BD.day>>BD.month>>BD.year>>clinicID;
doctor d;
d.ID=ID;
d.first_name=first_name;
d.last_name=last_name;
d.BD.day=BD.day;
d.BD.month=BD.month;
d.BD.year=BD.year;
d.clinicID=clinicID;
doctorVec.push_back(d);
}
fin.close();
}
void loadCat(vector<string> &catVec)
{
fin.clear();
fin.open("cat.txt");
if(!fin)
{
cerr<<"File doesn't exist."<<endl;
exit(EXIT_FAILURE);
}
string name;
for(int i=0; !fin.eof(); i++)
{
fin>>name;
catVec.push_back(name);
}
fin.close();
}
bool checkCatName(string labCat, vector <string> catVec)
{
for(int i=0; i< catVec.size(); i++)
{
if(catVec[i]==labCat)
return true;
}
return false;
}
bool checkTestType(string test_type, vector <testType> testTypeVec)
{
for(int i=0; i< testTypeVec.size(); i++)
{
if(testTypeVec[i].test_type==test_type)
return true;
}
return false;
}
void loadTestType(vector<testType> &testTypeVec)
{
fin.clear();
fin.open("testType.txt");
if(!fin)
{
cerr<<"File doesn't exist."<<endl;
exit(EXIT_FAILURE);
}
string test_type;
string labName;
int startValue;
int endValue;
int unit;
for(int i=0; !fin.eof(); i++)
{
fin>>test_type>>labName>>startValue>>endValue>>unit;
testType t;
t.test_type=test_type;
t.labName=labName;
t.startValue=startValue;
t.endValue=endValue;
t.unit=unit;
testTypeVec.push_back(t);
}
fin.close();
}
void recipe_window()
{
start: system("cls");
cout<<"Enter patient ID: ";
int pID;
cin>>pID; //then check if it exists
if(!checkPatientID(pID, patientVec))
{
cout<<"Patient doesn't exist. \nPress X to enter patient ID again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter doctor ID: ";
int dID;
cin>>dID; // then check if it exists
if(!checkDoctorID(dID, doctorVec))
{
cout<<"Doctor doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"How many medicines you will add: ";
int N_medic;
cin>>N_medic;
int medIDs[N_medic];
for(int i=0; i<N_medic; i++)
{
cout<<"Enter the ID of the medicine number "<<i+1<<": ";
cin>>medIDs[i];
//checkMedID(medIDs[i],medVec);
}
}
void testResult_window()
{
start: system("cls");
cout<<"Enter patient ID: ";
int pID;
cin>>pID; //then check if it exists
if(!checkPatientID(pID, patientVec))
{
cout<<"Patient doesn't exist. \nPress X to enter patient ID again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter doctor ID: ";
int dID;
cin>>dID; // then check if it exists
if(!checkDoctorID(dID, doctorVec))
{
cout<<"Doctor doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();
}
cout<<"Enter the test type: ";
string test_type;
cin.ignore();
getline(cin, test_type); //then check if it exists
if(!checkTestType(test_type, testTypeVec))
{
cout<<"Test Type doesn't exist doesn't exist. \nPress X to enter information again.";
char a;
a=getch();
if(a=='x' || a=='X')
{
goto start;
}
else
patients_window();