You are viewing a single comment's thread. Return to all comments →
using namespace std; //Implement the class Box class Box{ private: int l,b,h;
public: // constructors: Box(){ l=0; b=0; h=0; } Box(int length, int breadth, int height){ l = length; b = breadth; h = height; } Box( const Box& B){ l = B.l; b = B.b; h = B.h; } // other functions: int getLength(){ return l; } int getBreadth(){ return b; } int getHeight(){ return h; } long long CalculateVolume(){ return (long long)l*b*h; } //Overload operator < as specified friend bool operator< (Box const& A, Box const& B){ if( (A.l < B.l) || ((A.b < B.b) && (A.l == B.l)) || ((A.h < B.h) && (A.l == B.l) && (A.b == B.b)) ){ return true; }else{ return false; } } friend ostream& operator<< (ostream& output, const Box& B){ output<< B.l<<" "<<B.b<<" "<<B.h; return output; }
};
void check2() { int n; cin>>n; Box temp; for(int i=0;i>type; if(type ==1) { cout<>l>>b>>h; Box NewBox(l,b,h); temp=NewBox; cout<>l>>b>>h; Box NewBox(l,b,h); if(NewBox
}
int main() { check2(); }
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 →
include
include
include
include
include
include
using namespace std; //Implement the class Box class Box{ private: int l,b,h;
};
void check2() { int n; cin>>n; Box temp; for(int i=0;i>type; if(type ==1) { cout<>l>>b>>h; Box NewBox(l,b,h); temp=NewBox; cout<>l>>b>>h; Box NewBox(l,b,h); if(NewBox
}
int main() { check2(); }