Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <string>
- #include <algorithm>
- using namespace std;
- string bin;
- int duljina;
- string b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf;
- int main(int argc, char *argv[])
- {
- b0 = "0000";
- b1 = "0001";
- b2 = "0010";
- b3 = "0011";
- b4 = "0100";
- b5 = "0101";
- b6 = "0110";
- b7 = "0111";
- b8 = "1000";
- b9 = "1001";
- ba = "1010";
- bb = "1011";
- bc = "1100";
- bd = "1101";
- be = "1110";
- bf = "1111";
- cin >> bin;
- for( int i = 0 ; i < bin.size() ; i += 4 ) {
- string Ret;
- for( int j = 0 ; j < 4 ; ++j )
- Ret += bin[ i + j ];
- if (Ret == b0) cout << "0";
- else if (Ret == b1) cout << "1";
- else if (Ret == b2) cout << "2";
- else if (Ret == b3) cout << "3";
- else if (Ret == b4) cout << "4";
- else if (Ret == b5) cout << "5";
- else if (Ret == b6) cout << "6";
- else if (Ret == b7) cout << "7";
- else if (Ret == b8) cout << "8";
- else if (Ret == b9) cout << "9";
- else if (Ret == ba) cout << "a";
- else if (Ret == bb) cout << "b";
- else if (Ret == bc) cout << "c";
- else if (Ret == bd) cout << "d";
- else if (Ret == be) cout << "e";
- else if (Ret == bf) cout << "f";
- }
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement