Friday, May 2, 2014

C++ Blood Donar and recipent program.

#include<iostream>
#include<cstring>
using namespace std;
int main()

{
char type[10],an;
cout<<"World Blood Donor Day is celebrated every 14th of June"<<endl;
cout<<"It encourages people to give blood and save lives."<<endl;
cout<<endl;
do{
cout<<"Please Enter your Blood Group here :";
cin>>type;
cout<<endl;
if(strcmp("AB+",type)==0||strcmp("ab+",type)==0 )
{
cout<<"You can donate blood to a person with type AB+."<<endl;
cout<<"You can recieve blood from anyone."<<endl;
cout<<"AB is the universal recipient. "<<endl;
}

else if(strcmp("AB-",type)==0||strcmp("ab-",type)==0)
{
cout<<"You can donate blood to a person with type AB+ or AB-."<<endl;
cout<<"You can recieve blood from O-,A-,B- and AB-."<<endl;
cout<<"AB is the universal recipient. "<<endl;

}

else if(strcmp("B+",type)==0||strcmp("b+",type)==0)
{
cout<<"You can donate blood to a person with type AB+ or B+."<<endl;
cout<<"You can recieve blood from O+,O-,B+ and B-."<<endl;

}

else if(strcmp("B-",type)==0||strcmp("b-",type)==0)
{
cout<<"You can donate blood to a person with type B+,B-,AB+ and AB-."<<endl;
cout<<"You can recieve blood from O- and B-."<<endl;

}
else if(strcmp("A+",type)==0||strcmp("a+",type)==0)
{
cout<<"You can donate blood to a person with type A+ or AB+."<<endl;
cout<<"You can recieve blood from O+,O-,A+ and A-."<<endl;

}
else if(strcmp("A-",type)==0||strcmp("a-",type)==0)
{
cout<<"You can donate blood to a person with type A+,A-, AB+ and AB-."<<endl;
cout<<"You can recieve blood from O- and A-."<<endl;

}

else if(strcmp("o-",type)==0||strcmp("O-",type)==0)
{
cout<<"You can donate blood to a anyone."<<endl;
cout<<"You can recieve blood from O-."<<endl;
cout<<" O is the universal donor."<<endl;


}
else if(strcmp("o+",type)==0||strcmp("O+",type)==0)
{
cout<<"You can donate blood to a person with type O+,A+, B+ and AB+."<<endl;
cout<<"You can recieve blood from O+ and O-."<<endl;
cout<<" O is the universal donor."<<endl;

}
else
{
cout<<"Invaild type of group, try again";
}

cout<<endl;
cout<<"Do you wanna check another blood group? (Y,N)";
cin>>an;
}while(an=='y'||an=='Y');



return 0;
}

No comments :

Post a Comment