Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void fun(int num)
- {
- switch (num)
- {
- case 7: cout << "AB+"; break;
- case 6: cout << "AB-"; break;
- case 5: cout << "A+"; break;
- case 4: cout << "A-"; break;
- case 3: cout << "B+"; break;
- case 2: cout << "B-"; break;
- case 1: cout << "0+"; break;
- case 0: cout << "0-"; break;
- }
- }
- int main()
- {
- string blood;
- cin >> blood;
- int number, thirdbit;
- int limit=7;
- if(blood.length() == 2)
- {
- if(blood[0] == '0') number = 0;
- if(blood[0] == 'A') number = 1 << 2;
- if(blood[0] == 'B') number = 1 << 1;
- if(blood[1] == '+') number = number | 1;
- }
- if(blood.length() == 3 && (blood[2] == '+')) number = 7;
- if(blood.length() == 3 && (blood[2] == '-')) number = 6;
- for (int i=7 ; i >= number ; i--)
- {
- if((i >= number) && ((i >> 2) >= (number >> 2)))
- {
- fun(i);
- }
- if (i != number) cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement