Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <climits>
- using namespace std;
- int main()
- {
- string donorName;
- string donorGender;
- int donorWeight;
- int donorHeight;
- int donorAge;
- cout << "What is the donor's name?" << endl;
- getline(cin, donorName);
- cout << "What is the donor's gender?" << endl;
- getline(cin, donorGender);
- cout << "What is the donor's age?(in years)?" << endl;
- cin >> donorAge;
- cout << "What is the donor's weight(in pounds)?" << endl;
- cin >> donorWeight;
- cout << "What is the donor's height?(in inches)" << endl;
- cin >> donorHeight;
- if (donorName == "")
- {
- cout << " --- You must enter a valid name." << endl;
- return (-1);
- }
- else if (donorGender != "Male" && donorGender != "Female" && donorGender != "Trans Male" && donorGender != "Trans Female" && donorGender != "Queer" && donorGender != "Different")
- {
- cout << "--- You must enter a valid gender." << endl;
- return (-1);
- }
- else if (donorAge <= 0)
- {
- cout << "--- You must enter a valid age." << endl;
- return (-1);
- }
- else if (donorWeight <= 0)
- {
- cout << "--- You must enter a valid weight." << endl;
- return (-1);
- }
- else if (donorHeight <= 0)
- {
- cout << "--- You must enter a valid height." << endl;
- return (-1);
- }
- else
- if (donorAge < 16 && donorWeight < 110)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- else if (donorWeight < 110)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- else if (donorGender == "Trans Male" && donorGender == "Trans Female" && donorGender == "Queer" && donorGender == "Different" )
- {
- if (donorAge < 23)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- }
- else if (donorGender == "Male")
- {
- if (donorAge >= 16 && donorAge <= 22)
- {
- if (donorHeight < 60)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- }
- }
- else if (donorGender == "Female")
- {
- if (donorAge >= 16 && donorAge <= 22)
- {
- if (donorHeight < 58)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- }
- }
- else if (donorGender == "Female")
- {
- if (donorAge >= 16 && donorAge <= 22)
- {
- if (donorHeight == 58)
- {
- if (donorWeight < 146)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- }
- }
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- else if (donorGender == "Female" && donorAge >= 16 && donorAge <= 22 && donorHeight == 59 && donorWeight < 142)
- {
- if (donorAge >= 16 && donorAge <= 22)
- {
- if (donorHeight == 59)
- {
- if (donorWeight < 142)
- {
- cout << "--- No, " << donorName << " you cannot donate blood." << endl;
- return (-1);
- }
- }
- }
- }
- else
- {
- cout << "--- Yes, " << donorName << " you can donate blood." << endl;
- }
- return (0);
Add Comment
Please, Sign In to add comment