#include<bits/stdc++.h>
using namespace std;
class Box{
private:
int l,b,h;
public:
Box(){
l=0;
b=0;
h=0;
}
Box(int a,int d,int c){
l=a;
b=d;
h=c;
}
Box(Box& source){
l=source.l;
b=source.b;
h=source.h;
}
int getLength(){
return l;
}
int getBreadth (){
return b;
}
int getHeight (){
return h;
};
long long CalculateVolume(){
return this->l*this->b*this->h;
};
friend bool operator<(Box & s1,Box &source){
return (s1.l*s1.b*s1.h)<(source.l*source.b*source.h);
}
friend ostream& operator<<(ostream& out,const Box& B){
out<<B.l<<" "<<B.b<<" "<<B.h;
return out ;
}
};
void check2()
{
int n;
cin>>n;
Box temp;
for(int i=0;i<n;i++)
{
int type;
cin>>type;
if(type ==1)
{
cout<<temp<<endl;
}
if(type == 2)
{
int l,b,h;
cin>>l>>b>>h;
Box NewBox(l,b,h);
temp=NewBox;
cout<<temp<<endl;
}
if(type==3)
{
int l,b,h;
cin>>l>>b>>h;
Box NewBox(l,b,h);
if(NewBox<temp)
{
cout<<"Lesser\n";
}
else
{
cout<<"Greater\n";
}
}
if(type==4)
{
cout<<temp.CalculateVolume()<<endl;
}
if(type==5)
{
Box NewBox(temp);
cout<<NewBox<<endl;
}
}
}
int main()
{
check2();
}
when I input this.
6
2 1039 3749 8473
4
3 1456 3836 283
3 729 3749 272
2 4839 283 273
4
Output should be .. What I get
1039 3749 8473
33004122803 here -1355615565
Greater
Lesser Greater
4839 283 273
373856301
all other output is correct I dont know why I am getting this type of bug in my code .