Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include<iostream>

#include<string>
using namespace std;
char arr[100];
int check(char blood_type[100])
{
int f;
do {
cin >> blood_type;
char* ptr = strstr(arr, blood_type);
if (ptr != NULL)
{

f = 4;
}
else
{
f = 2;
}

} while (strcmp(blood_type, arr) == 0);


return f;
}
int main()
{
system("color 2b");
cout << "\n\t\tProject...";
cout << "\n\t\t\tBlood Bank Management System....";
cout << "\n\t\tCreated by...";
cout << "\n\t\t\tASAD ALI BSE183027...";

char q;
do
{
int a, HP, weight, quantity, disease;
char type[3];
cout << "WELCOME TO BLOOD BANK " << endl;
cout << "MENU" << endl;
cout << "\t\t\t\t\t\DONATE BLOOD\t\t\t\t\t" << endl;

cout << " BUY BLOOD " << endl;

cout << " OPTION ";

cin >> a;

if (a == 1)
{
cout << "\tWhat is your HP level\t : ";
cin >> HP;

cout << "\tWhat is your weight(kg)\t : ";


cin >> weight;

cout << "Did you have any disease\t" << endl;


cout << "\t\t\tNO = = = 3 " << endl << "\t\t\tYES = = = 4" << endl;

cout << "Option : : ";

cin >> disease;

if (HP >= 10 && HP <= 17.5 && weight > 47 && disease == 3)
{

cout << " You have permission to donate blood" << endl;

cout << "How much bottle of blood do you want to donate";

cin >> quantity;

for (int i = 0; i < quantity; i++)


{
cout << "Enter Blood Group you want to Donate..." << i
+ 1 << ": ";

cin >> type[3];

cin.ignore();

arr[25 + i] = type[3];
}

cout << "THANK YOU FOR DONATING BLOOD " << endl;

cout << "ALLAH HAFIZ" << endl;


}
else
cout << "You are not able to donate blood" << endl;
}

if (a == 2)
{
strcpy_s(arr, "A,A+,A-,B,B+,B-,AB+,AB-,AB,a,a+,a-,b+,b,b-
,O,o,O+,o+,o-,O-,ab,ab+,ab-");

int quantity;

char blood_type[2];

int num = 0;

int num1;

cout << " How much bottle do you require : ";

cin >> quantity;

for (int i = 0; i < quantity; i++)

{
cout << "Enter a Bottle of Blood Group you Need.. " << i + 1
<< " : ";
num1 = check(blood_type);
if (num1 == 4)
{
cout << "Blood type " << blood_type << " is available:"
<< endl;
}
else
cout << "Blood type " << blood_type << " is not
available :" << endl;
}

cout << "THANK YOU FOR COMMING " << endl;


}

cout << " If you want to run it again press y" << endl;
cin >> q;
} while (q == 'Y' || q == 'y');

system("color 6b");

system("pause");

return 0;
}

You might also like