Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
1412 lines (1410 loc) · 72.4 KB
/
Copy pathmain.cpp
File metadata and controls
1412 lines (1410 loc) · 72.4 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
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
//***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<iostream>
#include<conio.h>
#include<string>
#include<fstream>
#include <bits/stdc++.h>
using namespace std;
//***************************************************************
// global declaration
//****************************************************************
void Instructions(int);
void exitprogram();
char donors[8][4]={"A+","A-","B+","B-","O+","O-","AB+","AB-"};
int number_donors[]={9,2,6,7,8,0,7,1};
int number_plasma_donors[]={5,4,2,9,3,0,8,8};
//***************************************************************
// Function declaration
//****************************************************************
void List_of_plasma_donors();
void Assign_date(int k);
void Blood_request(int z);
void plasma_request(int z);
void List_of_blood_donors();
void Instructions(int a);
void exitprogram();
//****************************************************************
// CLASS USED IN PROJECT//FORWARD DECLARATION
//****************************************************************
class Person_personalInfo;
class Person_HealthInfo;
class Patient;
class Donor;
class Plasma;
class Donation_camps;
class Person_personalInfo
{
protected:
char email[25];
string phone_num,fname,lname,id,address;
int age;
char gender;
public:
void getDetails()
{
cout <<"\n# Fill the following form for the registration:\n”;
cout << "------------------------------------------------"<<endl;
cout << "* ID:";
srand(time(NULL));//initialize random number
generator for ID
cout << (rand() %10) + 7;
cout << "\n* Enter first name:";
cin >>fname;
cout << "* Enter last name:";
cin >>lname;
cout << "* Enter your address:";
cin.ignore(); //used to ignore or clear one or
more characters from the input buffer
getline(cin,address);
cout << "* Enter Email ID:";
cin >> email;
cout << "* Enter your age:";
cin>>age;
while(phone_num.size() != 10)
{
cout<<"* Enter your phone number:";
cin>>phone_num;
if(phone_num.size() != 10)
cout<<"Invalid phone number! Enter again!\n";
}
cout<<"* Gender(F for female / M for male):";
cin>> gender;
}
}; //Class ends here
class Person_HealthInfo
{
protected:
int dd2,mm2,yyyy2;
int dd1=26,mm1=4,yyyy1=2021;
int dd,mm,yyyy;
float Temp,Haemoglobin;
double weight, blood_pressure_d, pulse_rate,blood_pressure_s;
string blood_group;
public:
int getHealthDetails(int z)
{
cout << "\n\n# HEALTH INFORMATION:"<<endl;
cout << "---------------------------------------------"<<endl;
cout << "* Enter your body temperature(in deg celsius):";
cin >> Temp;
cout << "* Haemoglobin(in grams per deciliter):";
cin >>Haemoglobin;
cout << "* Enter your body weight(in kg):";
cin >> weight;
cout << "* BP(in mm Hg):\n";
cout<<"* Diastolic :";
cin >>blood_pressure_d;
cout<<"* Systolic :";
cin >>blood_pressure_s;
cout << "* Enter your pulse rate(beats/min):";
cin >>pulse_rate;
cout << "* Enter your blood group:";
cin >>blood_group;
cout<<"Enter your last bold donation date in formatdd mm“
cout<<” yyyy\n";
cin>>dd2>>mm2>>yyyy2;
yyyy=yyyy1-yyyy2;
mm=mm1-mm2;
dd=dd1-dd2;
if(dd<0)
{
mm--;
dd+=30;
}
if (mm<0)
{
yyyy--;
mm+=12;
}
try //Using try and catch block for exception handling
{
if(mm<3&&yyyy<1)
throw mm;
}
catch(int k)
{
Instructions(1); //user informed
cout<<"--------------------------------------------“;
cout<<”---------";
cout<<"\nYour last donation must be three months “;
cout<<”prior\n";
cout<<"\nAs per the instruction for blood donation ”;
cout<<”you are not fit to donate blood\n\n";
if(z==5)
{
return z;
}
getch();
exitprogram();
}
return 0;
}
}; //class ends here
class Plasma:publicPerson_personalInfo
{
private:
int eligiblity=0;
float wgt,protein;
float bp_d,bp_s;
string hname,haddress;
public:
void Plasma_to_hospital()
{
cout << "\n# Enter the details of the hospital:\n";
cout << "~ Enter the name of the hospital:";
cin.ignore();
//used to ignore or clear one or more characters from the
input buffer.
getline(cin,hname);
cout << "~ Enter the address of the hospital:";
cin.ignore();
getline(cin,haddress);
}
void donate_plasma()
{
if(eligiblity==1)
{
int num;
char ch;
srand(time(NULL));
num=rand()%1000;
cout<<"\n# PLASMA DONATION AREA";
cout<<"\n=======================";
cout<<"\n\n-------->Instructions";
cout<<"\n#Drink lots of water before donating on your”;
cout<<” plasma";
cout<<"\n#Eat a healthy meal within two hours of your “;
cout<<”visit";
cout<<"\n#Avoid foods high in fat or cholesterol";
cout<<"\n#Don't use tobacco for an hour after donating";
cout<<"\n#Avoid alcohol and caffeine before and after “;
cout<<”plasma is donated";
cout<<"\n#Avoid strenuous exercise an hour before “;
cout<<”plasma donation";
PLASMA:cout<<"\n\n-------->Have you read all the “;
cout<<”instructions??(y/n)";
cin>>ch;
if(ch=='y'||ch=='Y')
//using if and else ladder to check the conditions
for plasma donation
{
cout<<"Your room number is:"<<num;
getch();
cout<<"\nPlasma donated :)) Thanks for your “;
cout<<”donation!!\n We want you to encourage “;
cout<<”other to donate plasma";
getch();
exitprogram();
}
else
{
cout<<"Please read them carefully and little “;
cout<<”bit fastly :))";
getch();
goto PLASMA;
// one-way transfer of control to another line
of code
}
}
else
{
cout<<"\n-------->Please undergo health checkup first!!\n";
getDetails();
//user want to donate plasma without entering
his /her details
Plasma_health_details();
Instructions(2);
donate_plasma();
}
}
void Plasma_health_details()
{
char ch,ch1,ch2;
if(age<18) //using if and else to check the conditions for plasma
{
Instructions(2);
getch();
cout<<"\n\n-------->Oops !! Too young to donate plasma";
exitprogram();
}
else if(age>69)
{
Instructions(2);
getch();
cout<<"\n\n-------->Too old to donate plasma";
exitprogram();
}
else
{
cout<<"\n|----------HEALTH INFORMATION------------|";
cout<<"\n#Enter your weight:";
cin>>wgt;
if(wgt<50)
{
Instructions(2);
getch();
cout<<"\n\n-------->Sorry but you are underweight";
exitprogram();
}
else
{
cout<<"#Are you suffering from any “;
cout<<”chronic disease?(y/n):";
cin>>ch;
cout<<endl;
if(ch=='n'||ch=='N')
{
cout<<"#Enter your daily protein “;
cout<<”intake(in g):";
cin>>protein;
if(protein<50||protein>80)
{
Instructions(2);
getch();
cout<<"\n\n-------->Sorry!! but your“;
cout<<” daily intake of proteins “;
cout<<”does not allow you to donate “;
cout<<”plasma";
exitprogram();
}
else
{
cout<<"#Have you undergone “;
cout<<”any Antibody Test?(y/n):";
cin>>ch1;
if(ch1=='Y'||ch1=='y')
{
cout<<"-------->Please “;
cout<<”submit your reports ”;
cout<<”at the reception!!";
getch();
cout<<"\nMedical“;
cout<<”reports approved!!";
cout<<"\n#Enter your “;
cout<<”Blood pressure:”;
cout<<”Diastolic(in mm Hg):";
cin>>bp_d;
if(!(bp_d>50&&bp_d<100))
//user informed why he
can't donate plasma
{
Instructions(2);
getch();
cout<<"\n\n------->>”;
cout<<”Sorry but Blood“;
cout<<” pressure:”; cout<<”Diastolic is not”;
cout<<” appropriate";
exitprogram();
}
else
{
cout<<"#Enter “;
cout<<”your Blood “;cout<<”pressure:”;
cout<<”Systolic(in mm “; cout<<”Hg):";
cin>>bp_s;
if(!(bp_s>100
&&bp_d<160))
{
Instructions(2);
getch();
cout<<"\n\n----“;
cout<<”---->”;
cout<<”Sorry “;
cout<<”but “;
cout<<”Blood ”;
cout<<”pressure”;
cout<<”:Systolic “;
cout<<”is not “;
cout<<”appropria”;
cout<<”te";
exitprogram();
}
else
{
cout<<"--------->
cout<<”Blood “;
cout<<”pressure”;
cout<<” is “;
cout<<”appropria”;cout<<”te!!";
cout<<"\n\n----“;
cout<<”----->”;
cout<<”Reason “;
cout<<”for “;
cout<<”donating “;
cout<<”plasma\n”;
cout<<”1.Cured “;
cout<<”from “; cout<<”corona\n”;
cout<<”2.Got “;
cout<<”vaccinat”;
cout<<”ed\n3.No”;
cout<<” reason";
cout<<"\nEnte”;
cout<<”ryour “;
cout<<”choice:";
cin>>ch2;
if(ch==3)
{
Instructions(2);
getch();
cout<<"\n”;
cout<<”\n”;
cout<<”--“;
cout<<”--“;
cout<<”----->Sorry but since you have not undergone any of the above 2 options so can't donate"; exitprogram();
}
else
eligibility=1;
}
}
}
else
{
Instructions(2);
getch();
cout<<"\n\n-------->Sorry “;
cout<<”but without Antibody “;
cout<<”test you can't donate";
exitprogram();
}
}
}
else
{
Instructions(2);
getch();
cout<<"\n-------->Sorry but since you “;
cout<<”are suffering from chronic disease “;
cout<<”so can't donate plasma ";
exitprogram();
}
}
}
}
}; //class ends here
class Donor: public Person_personalInfo, public Person_HealthInfo
{
private:
string disease_name;
int c=0;
public:
char ch;
void certificate();
void disease()
{
cout << "* Are you suffering from any disease? [Y/N]: ";
cin >> ch;
if(ch == 'y' || ch == 'Y')
{
cout << "~Name the disease:";
cin.ignore();
getline(cin, disease_name);
}
}
void criteria1()
{
try //Using try and catch block for exception handling
{
if(!(age>=18&&age<65))
{
c++;
throw age;
}
else if(!(pulse_rate>50 &&pulse_rate<100))
{
c++;
throw 'a';
}
else if (Haemoglobin<12.5)
{
c++;
throw Haemoglobin;
}
else if(weight<45)
{
c++;
throw"*The donor should weigh minimum of 50 kg";
}
}
catch(int a)
{
cout<<"*The donor must be 18-65 years old.\n";
}
catch(char code )
{
cout<<"*The donor pulse rate should be between 50 and “;
cout<<”100 without irregularities.\n";
}
catch(float num)
{
cout<<"*The donor Hemoglobin level should be -A “;
cout<<”minimum of 12.5 g/dL.\n";
}
catch(const char *str)
{
cout<<str;
}
}
void criteria2()
{
try //Using try and catch block for exception handling
{
if(Temp>37.5)
{
c++;
throw Temp;
}
else if(!(blood_pressure_d>50&&blood_pressure_d<100))
{
c++;
throw 'k';
}
else if(!(blood_pressure_s>100&&blood_pressure_s<180))
{
c++;
throw 2;
}
else if(ch=='y'||ch=='Y')
{
c++;
throw "*The donor must be physically fit";
}
}
catch(float num)
{
cout<<"*Body temperature- Should be normal, with an “;
cout<<”oral temperature not exceeding 37.5 Degree:C\n";
}
catch( char c)
{
cout<<"*Blood pressure- Diastolic: 50-100 mm Hg\n";
}
catch(int a)
{
cout<<"*Blood pressure-Systolic: 100-180 mm Hg\n";
}
catch(const char *str1)
{
cout<<str1;
}
}
int criteria3(int m)
{
int room;
if(c>0) // informing the user why he can't donate blood
{
cout<<"-----------------------------------------------------";
cout<<"\nAs per the instructions for blood donation you “;
cout<<”are not fit to donate blood\n";
if(m!=5)
{
getch();
exitprogram();
}
else
{
return m;
}
}
else
{
//informing the user how to proceed after he/she
is eligible to donate blood
cout<<"-----------------------------------------------------";
cout<<"\nAs per our instructions for blood donation ,“;
cout<<”you are fit to donate blood\n";
room= rand() % 5 + 7;
cout<<"You can head to Room No "<<room<<" for “;
cout<<”the donation process\n";
getch();
certificate();
if(m==5)
{
cout<<"\nThe blood will be delivered at the “;
cout<<”entered address hospital address!!\n";
}
getch();
exitprogram();
return 0;
}
}
}; // class ends here
void Donor::certificate()
{
//Printing the certificate for appreciation of blood donation
cout<<"_____________________________________________________”;
cout<<”_____________________________________________________”;
cout<<”________________________\n";
cout<<"\n|*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_|~|~|~|”;
cout<<”~ CERTIFICATE OF APPRECIATION ~|~|~|~|_*_*_*_*_*_*_*_*”;
cout<<”_*_*_*_*_*_*_*_*_*_*_*_*|";
cout<<"\n_______________________________________________”;
cout<<”_________________________________________________”;
cout<<”________________________________\n\n\n";
cout<<"\nThis is to certify Mr/Ms :"<<fname<<" "<<lname<<" has donate blood “;
cout<<”on date to our blood bank.His/her blood group is "<<blood_group<<".\n";
cout<<"We express our heartfelt gratitude to you. With your valuable “;
cout<<”donation , you are saving so many lives .";
cout<<"\nWe are confident that your altruistic act of blood donation will “;
cout<<"be followed by many individuals.\nWe request you to encourage “;
cout<<”the importance of voluntary blood donation , which will tremendously”;
cout<<” support to serve the needy patients .\n\n";
}
class Patient: public Person_personalInfo, public Person_HealthInfo
{
private:
string hospital_name, hospital_address, disease;
public:
void get_hospitalInfo()
{
cout << "\n# Enter the details of the hospital:\n";
cout << "~ Enter the name of the hospital:";
cin.ignore();
getline(cin,hospital_name);
cout << "~ Enter the address of the hospital:";
cin.ignore();
//used to ignore or clear one or more characters from the
input buffer
getline(cin,hospital_address);
cout << "Enter the name of the disease you are suffering from:";
cin.ignore();
getline(cin,disease);
}
}; //class ends here
class Donation_camps
{
private:
char email[25];
string phone_num, name, id, address, city, msg, oname;
int age, dd, mm, yyyy = 2021, minutes, hours, vol;
public:
void Organizer_Details()
{
//organizer details
cout << "Enter your contact details:\n";
cout << "\n* Enter your name:";
cin.ignore();
getline(cin,name);
cout << "* Enter your address:";
cin.ignore();
getline(cin,address);
cout << "* Enter Email ID:";
cin >> email;
cout << "* Enter your age:";
cin>>age;
if(age < 18)
//checking condition whether user is able to organize a camp
{
cout << "\nYou are not yet eligible to organize a camp!\n";
exitprogram();
}
while(phone_num.size() != 10)
{
cout << "* Enter your phone number:";
cin >>phone_num;
if(phone_num.size() != 10)
cout << "Invalid phone number! Enteragain!\n\n”;
}
}
void Camp_Details()
{
int ch = 0;
cout << "Enter the following details for the camp:\n";
while(ch <= 0 || ch >= 3)
{
cout << "\nWhich camp do you want to organize?\n”;
cout<<”1.Blood Donation Camp\n2.Plasma Donation Camp\n";
cout << "\nPlease enter your choice : ";
cin >> ch;
}
cout << "\nOrganize camp in City region: ";
cin.ignore();
//used to ignore or clear one or more characters from the
input buffer
getline(cin,city);
cout << "Your organization name / university name: ";
cin.ignore();
getline(cin,oname);
cout << "Estimated number of volunteers: ";
cin >> vol;
label: cout<<"Enter the date you want to organize the “;
cout<<”camp on(format dd mm yyyy): "<<endl;
cout << "Date:"; cin >> dd;
cout << "Month:"; cin >> mm;
cout << "Year:"; cin >>yyyy;
if(yyyy - 2021 >= 0 && (mm >=1 && mm <=12))
//checking whether date is valid or not using if-else statement
{
if(mm==1||mm==3||mm==5||mm==7||mm==8||mm==10
|| mm==12)
{
if(!(dd>=1 && dd<=31))
{
cout<<"\nInvalid date...Enter again!\n";
goto label;
}
}
else if(mm==4 || mm==6 || mm==9 || mm==11)
{
if(!(dd>=1 && dd<=30))
{
cout<<"\nInvalid date...Enter again!\n";
goto label;
}
}
else if(mm==2)
{
if(!(dd>=1 && dd<=29))
{
cout<<"\nInvalid date...Enter again!\n";
goto label;
}
}
else
{
cout<<"\nInvalid date...Enter again!\n";
goto label;
}
}
else
{
cout<<"\nInvalid date...Enter again!\n";
goto label;
}
time: cout<<"\nEnter the time of camp(24 hours format)"<<endl;
cout << "Hours:";
cin >> hours;
cout << "Minutes:";
cin >> minutes;
if(minutes >= 60) //checking whether time entered is correct
hours+=minutes/60; or not using if-else statements
if(hours >= 8 && hours <= 19)
cout << "You can organize the camp!\nOne of our “;
cout<<”volunteers will contact you soon to help you “;
cout<<”with the organization of camp.\n";
else
{
cout << "Please choose some other time\n";
goto time;
}
cout<<"\nDo you want to leave any message for us? ";
cin.ignore();
getline(cin,msg);
//used to read a string or a line from an input stream
}
}; //class ends here
void Assign_date(int k)
{
Donor D; //object of class donor
int d,m,y,choice;
cout<<"\n\n\t\t--------------------------------------------------------------\n";
cout<<"\t\t|Hi ,Thank you for being a valuable part of our life center. |\n\t”;
cout<<\t|We would like to know whether you would like to donate blood”;
cout<<”|\n\t\t|\t\t\t\t\t\t\t |";
cout<<"\n\t\t|\t\t1.Today\t\t\t\t\t | \n\t\t|\t\t2.Or any other day”;
cout<<”\t\t\t |";
cout<<"\n\t\t--------------------------------------------------------------\n";
do
{
cout<<"\n\n\t\tEnter your choice :";
cin>>choice;
if(choice==1)
{
cout<<"\n\nYou can proceed with the registration process ,”;
cout<<”Thank you\n\n";
if(k==1) //if user books his appointment before
registering himself
{
D.getDetails();
D.getHealthDetails(0);
D.disease();
Instructions(1);
D.criteria1();
D.criteria2();
D.criteria3(1);
}
}
else if(choice==2)
{
if(k==1)
{
cout<<"\n\nYou need to register yourself first\n";
D.getDetails();
}
DATE;cout<<"\n\n\t\tEnter the day on which you want to “;
cout<<”donate in format dd mm yyyy"<<endl;
cout<<"\n\t\t";
cin>>d;
cout<<"\t\t";
cin>>m;
cout<<"\t\t";
cin>>y;
if(y - 2021 >= 0 && (m >=1 && m <=12))
//checking whether date is valid or not using if-else statement
{
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
{
if(!(d>=1 && d<=31))
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
}
else if(m==4 || m==6 || m==9 || m==11)
{
if(!(d>=1 && d<=30))
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
//one-way transfer of control to another
line of code
}
}
else if(m==2)
{
if(!(d>=1 && d<=29))
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
}
else
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
}
else
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
if(y==2021)
{
int dd1=8,mm1=5,yyyy1=2021;
if(m<mm1)
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
else if(m==mm1)
{
if(d<dd1)
{
cout<<"\nInvalid date...Enter again!\n";
goto DATE;
}
}
cout<<"\n\n\tYour date for blood donation is registered “;
cout<<”i.e "<<d<<"/"<<m<<"/"<<y;
cout<<"\n\tYou are requested to look through the “;
cout<<”instructions carefully\n\n";
getch();
Instructions(1);
getch();
exitprogram();
}
else
cout<<"\t\tWrong input ";
}while(!(choice==1||choice==2));
}
void Blood_request(int z)
{
int flag=0,unit,i,amount,flag1=0;
int mode,mode1;
Donor P;
Patient Pt;
int bill,acc[20];
int num;
char ch1[3],ch,pin[4];
cout<<"\n\tBLOOD REQUEST";
cout<<"\n\t|++++++++++++|";
cout<<"\n\nEnter the blood group you want:";
cin>>ch1;
for(i=0;i<8;i++)
{
if(strcmpi(ch1,donors[i])==0) //use of string function
{
if(number_donors[i]!=0)
{
flag=1;
cout<<"Blood group Available!!";
break;
}
else
cout<<"Sorry!! Blood group not available...Kindly “;
cout<<”contact some other blood management system";
}
}
if(z==2)
{
Pt.getDetails();
Pt.get_hospitalInfo();
cout<<endl;
}
if(flag==1)
{
cout<<"\nEnter the number of units you want:";
cin>>unit;
if(unit<=number_donors[i]) //checking whether number of units available
{
cout<<"------------>Yes!!! That much unit is available :)";
List_of_blood_donors();
cout<<"\n\nDo you want to purchase(Y/N)?:";
cin>>ch;
if(ch=='Y'||ch=='y')
{
cout<<"------------>The Blood cost you Rs.950/- per unit";
bill=950*unit;
cout<<"\nBILL:"<<bill;
number_donors[i]-=unit;
cout<<"\n\nYou have 2 process to do the payment!!";
cout<<"\n1.By cash";
cout<<"\n2.By donating the blood";
cout<<"\nEnter your choice:";
cin>>mode;
//different modes for payment using if else statements
if(mode==1)
{
BILL:cout<<"\n\n\n------------>By which “;
cout<<”mode are you going to pay?";
cout<<"\n1)Cash\n2)Paytm\n3)Credit OR “;
cout<<”Debit card!\nEnter Your Choice:";
cin>>mode1;
if(mode1==1)
{
cout<<"\n|- - - - - - - - - - - - - - - -|";
cout<<"\n Total Amount:"<<bill;
cout<<"\n Enter Amount tendered:";
cin>>amount;
cout<<" Balance Amount:"<<amount-bill;
cout<<"\n|- - - - - - - - - - - - - - - -|";
flag1=1;
}
else if(mode1==2)
{
cout<<"\n------------>Total Amount to “;
cout<<”be paid:"<<bill;
cout<<"\nPlease wait while we confirm “;
cout<<”your payment";
cout<<"\nPayment confirmed!!";
flag1=1;
}
else if(mode1==3)
{
int k;
cout<<"\nTotal Amount to be paid:"<<bill;
cout<<"\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ “;
cout<<”_ _ _ _ _";
cout<<"\n| \t\tAccountnumber \t|\n|\t\t";
for(k = 0;k<15;k++)
{
num=getch();
acc[k]=num;
cout<<(char)num;
}
cout<<"\t\t|";
k=0;
cout<<"\n|\t\t Pin \t\t\t|\n|\t\t ";
while( k<4)
{
pin[i]=getch();
cout<<"*";
k++;
}
cout<<"\t\t\t|";
cout<<"\n|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ “;
cout<<”_ _ _ _ _|";
flag1=1;
}
else
{
cout<<"Invalid number entered!!";
cout<<"\nKindly Enter a valid number!!\n";
goto BILL; //one way transfer control
to another line
}
if(flag1==1)
cout<<"\nThe blood will be delivered “;
cout<<”at the entered address hospital ”;cout<<”address!!";
}
else
{
cout<<"The person whose going to donate blood “;
cout<<”from your side should register as a donor “;
cout<<”now ";
P.getDetails();
int a=P.getHealthDetails(5);
if(a==5)
{
cout<<"\n\Sorry you can't donate the blood”;
cout<<”,you need to purchase it only\n";
goto BILL;
}
P.disease();
Instructions(1);
P.criteria1();
P.criteria2();
int k=P.criteria3(5);
getch();
if(k==5)
{
cout<<"\n\Sorry you can't donate the blood”;
cout<<”,you need to purchase it only\n";
goto BILL;
}
}
}
else
cout<<"No problem!! You can contact us anytime for “;
cout<<”the need of blood :))";
}
else
cout<<"Sorry!! That much unit is not available...Kindly contact “;
cout<<”some other blood management system";
}
}
void plasma_request(int z)
{
char ch1[4];
int num,d,m;
Plasma P1;
char time[3];
int c=1,k;
cout<<"\n\n||=||=||=||=||=|| PLASMA REQUEST ||=||=||=||=||=||=||";
BLOODGROUP:cout<<"\nEnter the blood group of the plasma you want:";
cin>>ch1;
int i;
for(int i=0;i<8;i++)
{
if(strcmpi(ch1,donors[i])==0) //use of string function
{
k=i;
c=0;
}
}
if(c!=0)
{
cout<<"-------->Sorry!! Invalid Blood group";
goto BLOODGROUP;
//one-way transfer of control to another line of code
}
if(z==3)
{
cout<<"\n-------->Please Enter your details first !!\n";
P1.getDetails();
P1.Plasma_to_hospital();
cout<<"\n\n||=||=||=||=||=|| PLASMA REQUEST ||=||=||=||=||=||=||";