#include <iostream.h>
#include<conio.h>
class box
{
double line,width,heigth;
double volume;
public:
box(double a,double b,double c);
void vol();
};
box::box(double a,double b,double c)
{
line=a;
width=b;
heigth=c;
volume=line*heigth;
}
void box::vol()
{
Cout<<“Volume is:” <<volume<<”\n”;
}
void main()
{
box x(3.4,4.5,8.5),y(2.0,4.0,6.0);
x.voI();
y.voI();
getch();
}
Output:
Volume is: 28.9
Volume is: 12