fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. constexpr const char * convert(char hx) {
  7. return "0000\0000001\0000010\0000011\0000100\0000101\0000110\0000111"
  8. "\0001000\0001001\0001010\0001011\0001100\0001101\0001110\0001111"
  9. + (hx|0x20)%87%48*5;
  10. }
  11.  
  12. int main(int argc, const char * argv[])
  13. {
  14. constexpr auto x0 = convert('0');
  15. constexpr auto x1 = convert('1');
  16. constexpr auto x2 = convert('2');
  17. constexpr auto x3 = convert('3');
  18. constexpr auto x4 = convert('4');
  19. constexpr auto x5 = convert('5');
  20. constexpr auto x6 = convert('6');
  21. constexpr auto x7 = convert('7');
  22. constexpr auto x8 = convert('8');
  23. constexpr auto x9 = convert('9');
  24. constexpr auto xa = convert('a');
  25. constexpr auto xb = convert('b');
  26. constexpr auto xc = convert('c');
  27. constexpr auto xd = convert('d');
  28. constexpr auto xe = convert('e');
  29. constexpr auto xf = convert('f');
  30. constexpr auto xA = convert('A');
  31. constexpr auto xB = convert('B');
  32. constexpr auto xC = convert('C');
  33. constexpr auto xD = convert('D');
  34. constexpr auto xE = convert('E');
  35. constexpr auto xF = convert('F');
  36. cout << x0 << "\n" << x1 << "\n" << x2 << "\n" << x3 << "\n" << x4 << "\n"
  37. << x5 << "\n" << x6 << "\n" << x7 << "\n" << x8 << "\n" << x9 << "\n"
  38. << xa << "\n" << xb << "\n" << xc << "\n" << xd << "\n" << xe << "\n"
  39. << xf << "\n" << xA << "\n" << xB << "\n" << xC << "\n" << xD << "\n"
  40. << xE << "\n" << xF << "\n";
  41. }
  42.  
  43.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
1010
1011
1100
1101
1110
1111