Guest User

Untitled

a guest
Jan 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <climits>
  4. using namespace std;
  5. int main()
  6. {
  7. string donorName;
  8. string donorGender;
  9. int donorWeight;
  10. int donorHeight;
  11. int donorAge;
  12.  
  13.  
  14. cout << "What is the donor's name?" << endl;
  15.  
  16. getline(cin, donorName);
  17.  
  18.  
  19. cout << "What is the donor's gender?" << endl;
  20. getline(cin, donorGender);
  21.  
  22.  
  23. cout << "What is the donor's age?(in years)?" << endl;
  24. cin >> donorAge;
  25.  
  26.  
  27. cout << "What is the donor's weight(in pounds)?" << endl;
  28. cin >> donorWeight;
  29.  
  30.  
  31. cout << "What is the donor's height?(in inches)" << endl;
  32. cin >> donorHeight;
  33.  
  34.  
  35.  
  36.  
  37. if (donorName == "")
  38. {
  39. cout << " --- You must enter a valid name." << endl;
  40. return (-1);
  41. }
  42.  
  43.  
  44. else if (donorGender != "Male" && donorGender != "Female" && donorGender != "Trans Male" && donorGender != "Trans Female" && donorGender != "Queer" && donorGender != "Different")
  45. {
  46. cout << "--- You must enter a valid gender." << endl;
  47. return (-1);
  48. }
  49.  
  50. else if (donorAge <= 0)
  51.  
  52. {
  53. cout << "--- You must enter a valid age." << endl;
  54. return (-1);
  55. }
  56.  
  57. else if (donorWeight <= 0)
  58. {
  59. cout << "--- You must enter a valid weight." << endl;
  60. return (-1);
  61. }
  62.  
  63. else if (donorHeight <= 0)
  64. {
  65. cout << "--- You must enter a valid height." << endl;
  66. return (-1);
  67. }
  68.  
  69. else
  70. if (donorAge < 16 && donorWeight < 110)
  71. {
  72. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  73. return (-1);
  74. }
  75.  
  76. else if (donorWeight < 110)
  77. {
  78. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  79. return (-1);
  80. }
  81.  
  82. else if (donorGender == "Trans Male" && donorGender == "Trans Female" && donorGender == "Queer" && donorGender == "Different" )
  83. {
  84. if (donorAge < 23)
  85. {
  86. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  87. return (-1);
  88. }
  89. }
  90.  
  91.  
  92. else if (donorGender == "Male")
  93.  
  94. {
  95. if (donorAge >= 16 && donorAge <= 22)
  96. {
  97. if (donorHeight < 60)
  98. {
  99. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  100. return (-1);
  101. }
  102. }
  103. }
  104.  
  105. else if (donorGender == "Female")
  106.  
  107. {
  108.  
  109. if (donorAge >= 16 && donorAge <= 22)
  110. {
  111. if (donorHeight < 58)
  112. {
  113. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  114. return (-1);
  115. }
  116. }
  117. }
  118.  
  119. else if (donorGender == "Female")
  120. {
  121. if (donorAge >= 16 && donorAge <= 22)
  122. {
  123. if (donorHeight == 58)
  124. {
  125. if (donorWeight < 146)
  126. {
  127. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  128. return (-1);
  129. }
  130. }
  131. }
  132. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  133. return (-1);
  134. }
  135.  
  136. else if (donorGender == "Female" && donorAge >= 16 && donorAge <= 22 && donorHeight == 59 && donorWeight < 142)
  137. {
  138. if (donorAge >= 16 && donorAge <= 22)
  139. {
  140. if (donorHeight == 59)
  141. {
  142. if (donorWeight < 142)
  143. {
  144. cout << "--- No, " << donorName << " you cannot donate blood." << endl;
  145. return (-1);
  146. }
  147. }
  148. }
  149.  
  150. }
  151. else
  152. {
  153. cout << "--- Yes, " << donorName << " you can donate blood." << endl;
  154. }
  155. return (0);
Add Comment
Please, Sign In to add comment