Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Box
- {
- public:
- Box()
- : m_a(new double), m_b(new double), m_c(new double)
- {
- *m_a = 1;
- *m_b = 1;
- *m_c = 1;
- }
- Box(const Box& other)
- : m_a(new double), m_b(new double), m_c(new double)
- {
- *m_a = other.a();
- *m_b = other.b();
- *m_c = other.c();
- }
- ~Box()
- {
- m_a = nullptr;
- m_b = nullptr;
- m_c = nullptr;
- delete m_a;
- delete m_b;
- delete m_c;
- }
- double a() const { return *m_a; }
- double b() const { return *m_b; }
- double c() const { return *m_c; }
- void set_a(double a) { *m_a = a; }
- void set_b(double b) { *m_b = b; }
- void set_c(double c) { *m_c = c; }
- double get_volume() { return (*m_a) * (*m_b) * (*m_c); }
- private:
- double *m_a, *m_b, *m_c;
- };
- int main()
- {
- Box baseBox;
- double a, b, c;
- do
- {
- std::cin >> a >> b >> c;
- Box box(baseBox);
- box.set_a(a);
- box.set_b(b);
- box.set_c(c);
- if(box.get_volume() < 1)
- {
- std::cout << "Malak \n";
- }
- else if(box.get_volume() > 1 && box.get_volume() < 5)
- {
- std::cout << "Sreden \n";
- }
- else if(box.get_volume() > 5)
- {
- std::cout << "Golqm \n";
- }
- } while(a != 1 && b != 1 && c != 1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement