Advertisement
Guest User

nn

a guest
Oct 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement