You are viewing a single comment's thread. Return to all comments →
class Box{ int l, b, h; public: Box(): l(0), b(0), h(0){}; Box(int l,int b,int h): l(l), b(b), h(h){}; Box(Box &x): l(x.l), b(x.b), h(x.h){}; int getLength() { return l; } int getBreadth(){ return b; } int getHeight() { return h; } long long CalculateVolume(){ return (long long)l*b*h; } bool operator<(const Box& x) { if (l < x.l) return true; if (b < x.b && l == x.l) return true; if (h < x.h && l == x.l && b == x.b) return true; return false; } friend ostream& operator<< (ostream& o, const Box& x){ o << x.l << " " << x.b << " " << x.h; return o; } };
Seems like cookies are disabled on this browser, please enable them to open this website
Box It!
You are viewing a single comment's thread. Return to all comments →