Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Binary {
- bool data[32];
- public:
- Binary();
- Binary(int value);
- Binary(char *s);
- void show() const; // Спецификатор const гарантирует, что в этом методе не изменяется состояние объекта.
- // В реализации он также указывается.
- int to_int() const;
- };
- Binary::Binary()
- {
- for(int i = 0; i < 32; i++)
- data[i] = {0} ;
- }
- Binary::Binary(int value)
- {
- do
- {
- a = ((value % 2)) + a;
- value = value / 2;
- }
- while (value > 0);
- return a;
- }
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement