daily pastebin goal
69%
SHARE
TWEET

nn

a guest Oct 11th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. void fun(int num)
  7. {
  8.     switch (num)
  9.     {
  10.         case 7: cout << "AB+"; break;
  11.         case 6: cout << "AB-"; break;
  12.         case 5: cout << "A+"; break;
  13.         case 4: cout << "A-"; break;
  14.         case 3: cout << "B+"; break;
  15.         case 2: cout << "B-"; break;
  16.         case 1: cout << "0+"; break;
  17.         case 0: cout << "0-"; break;
  18.     }
  19. }
  20.  
  21. int main()
  22. {
  23.     string blood;
  24.     cin >> blood;
  25.     int number, thirdbit;
  26.     int limit=7;
  27.  
  28.     if(blood.length() == 2)
  29.     {
  30.         if(blood[0] == '0') number = 0;
  31.         if(blood[0] == 'A') number = 1 << 2;
  32.         if(blood[0] == 'B') number = 1 << 1;
  33.         if(blood[1] == '+') number = number | 1;
  34.     }
  35.     if(blood.length() == 3 && (blood[2] == '+')) number = 7;
  36.     if(blood.length() == 3 && (blood[2] == '-')) number = 6;
  37.  
  38.     for (int i=7 ; i >= number ; i--)
  39.     {
  40.         if((i >= number) && ((i >> 2) >= (number >> 2)))
  41.         {
  42.             fun(i);
  43.         }
  44.         if (i != number) cout << "\n";
  45.     }
  46.  
  47.     return 0;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top