Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const double boxDefaultSize = 1;
- class Box
- {
- public:
- Box()
- {
- this->m_x = new double;
- this->m_y = new double;
- this->m_z = new double;
- *m_x = boxDefaultSize;
- *m_y = boxDefaultSize;
- *m_z = boxDefaultSize;
- }
- Box(Box &temp)
- {
- this->m_x = new double;
- this->m_y = new double;
- this->m_z = new double;
- *m_x = temp.GetX();
- *m_y = temp.GetY();
- *m_z = temp.GetZ();
- }
- Box(double x, double y, double z)
- {
- this->m_x = new double;
- this->m_y = new double;
- this->m_z = new double;
- *m_x = x;
- *m_y = y;
- *m_z = z;
- }
- ~Box()
- {
- m_x = NULL;
- m_y = NULL;
- m_z = NULL;
- delete m_x;
- delete m_y;
- delete m_z;
- }
- double GetX () { return *m_x;}
- double GetY () { return *m_y;}
- double GetZ () { return *m_z;}
- double GetV () { return *m_z**m_y**m_x; }
- bool IsEqual(Box &temp)
- {
- if(*m_x == temp.GetX()
- && *m_y == temp.GetY()
- && *m_z == temp.GetZ())
- return true;
- return false;
- }
- private:
- double *m_x;
- double *m_y;
- double *m_z;
- };
- int main()
- {
- Box defaultBox;
- double x,y,z;
- Box currentBox(-1,-1,-1);
- while(!defaultBox.IsEqual(currentBox))
- {
- std::cout << "vavedi xyz:" << std::endl;
- std::cin >> x >> y >> z;
- currentBox = Box(x,y,z);
- double currentV = currentBox.GetV();
- std::cout << "v = " << currentV << std::endl;
- if(currentV < 1)
- std::cout << "malka kutiq" << std::endl;
- else if (currentV > 1 && currentV < 5)
- std::cout << "sredna kutiq" << std::endl;
- else
- std::cout << "golqma kutiq" << std::endl;
- std::cout << currentBox.GetX() << " " << currentBox.GetY() << " " << currentBox.GetZ() << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement