#include <iostream>
using namespace std;
class Box
{
double width,height,depth;
public:
Box()
{
width=0;
height=0;
depth=0;
}
Box(double w, double h, double d)
{
width=w;
height=h;
depth=d;
}
double volume()
{
return width*height*depth;
}
};
int main()
{
Box mybox1;
double a,vol;
cout<<mybox1.volume()<<endl;
//cout<<value<<endl;
cin>>a;
Box mybox2(a,a,a);
vol = mybox2.volume();
cout<<vol;
return 0;
}
using namespace std;
class Box
{
double width,height,depth;
public:
Box()
{
width=0;
height=0;
depth=0;
}
Box(double w, double h, double d)
{
width=w;
height=h;
depth=d;
}
double volume()
{
return width*height*depth;
}
};
int main()
{
Box mybox1;
double a,vol;
cout<<mybox1.volume()<<endl;
//cout<<value<<endl;
cin>>a;
Box mybox2(a,a,a);
vol = mybox2.volume();
cout<<vol;
return 0;
}
change "Box(double w, double h, double d)"
ReplyDeleteto "Box(double w,double h,double d)"
for 100% result
Both r same
Delete//This code is working
ReplyDelete#include
using namespace std;
class Box
{
double width, height, depth;
public:
Box()
{
width = 0;
height = 0;
depth = 0;
}
Box(double samevalue)
{
width = samevalue;
height = samevalue;
depth = samevalue;
}
double volume()
{
return width * height * depth;
}
};
int main()
{
Box mybox1;
double a, vol;
cout << mybox1.volume() << endl;
cin >> a;
Box mybox2(a);
vol = mybox2.volume();
cout << vol;
return 0;
}
This comment has been removed by the author.
ReplyDeleteThis is a different question
Deletethe code is work 85% only
ReplyDelete#include
ReplyDeleteusing namespace std;
class Box
{
double width,height,depth;
public:
Box(double samevalue)
{
width=0;
height=0;
depth=0;
}
Box(double w, double h, double d)
{
width=w;
height=h;
depth=d;
}
double volume()
{
return width*height*depth;
}
};
int main()
{
double a,vol;
cin>>a;
Box mybox1(a);
cout<<mybox1.volume()<<endl;
Box mybox2(a,a,a);
vol = mybox2.volume();
cout<<vol;
return 0;
}