Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Binary {
  6. bool data[32];
  7. public:
  8. Binary();
  9. Binary(int value);
  10. Binary(char *s);
  11. void show() const; // Спецификатор const гарантирует, что в этом методе не изменяется состояние объекта.
  12. // В реализации он также указывается.
  13. int to_int() const;
  14. };
  15.  
  16. Binary::Binary()
  17. {
  18. for(int i = 0; i < 32; i++)
  19. data[i] = {0} ;
  20. }
  21.  
  22. Binary::Binary(int value)
  23. {
  24. do
  25. {
  26. a = ((value % 2)) + a;
  27. value = value / 2;
  28. }
  29. while (value > 0);
  30.  
  31. return a;
  32. }
  33.  
  34. int main()
  35. {
  36.  
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement