Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include<cstring>
  3. #include <vector>
  4. #include <cstdlib>
  5. #include <sstream>
  6. using namespace std;
  7.  
  8. int
  9. main ()
  10. {
  11.  
  12. vector < int >a (40);
  13.  
  14. int t = 0;
  15.  
  16. int y, x;
  17.  
  18. cin>>x;
  19. for (int i=0;i<40;i++) a[i] = 0;
  20.  
  21. do
  22. {
  23.  
  24. y = x % 10;
  25.  
  26. do
  27. {
  28.  
  29. t = t + 1;
  30.  
  31. a[t] = y % 2;
  32.  
  33. y = y / 2;
  34.  
  35. }
  36.  
  37. while (y != 0);
  38.  
  39. if (t % 4 != 0)
  40. t = t + 4 - t % 4;
  41.  
  42. x = x / 10;
  43.  
  44. }
  45.  
  46. while (x != 0);
  47.  
  48. do
  49. {
  50.  
  51. // itoa(a[t],res1,10);
  52.  
  53.  
  54. cout << a[t];
  55.  
  56. t = t - 1;
  57.  
  58. }
  59.  
  60. while (t != 0);
  61.  
  62.  
  63.  
  64.  
  65. return 0;
  66.  
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement