You need to ask for three cuboid volume, write an object-based program. Data members include length (length), Width (width), height (height).
(1) The length, width and height of the 3 cuboid are entered by the keyboard respectively.
(2) Calculate the volume of the cuboid.
(2) Output the volume of three cuboid.
Changfangxing.h header file:
Class Cfx
{
Public
void Set_v ();
int Get_v ();
Private
int length;
int width;
int height;
};
Changfangxing.cpp file:
#include <iostream>
#include "Changfangxing.h"
using namespace Std;
void Cfx::set_v ()
{
cin>>length;
cin>>width;
cin>>height;
}
int Cfx::get_v ()
{
int V;
V=length*width*height;
return v;
}
Flie.cpp file:
#include <iostream>
#include "changfangxing.h"
using namespace std;
Int main ()
{
Cfx c1,c2,c3;
C1.set_v ();
C2.set_v ();
C3.set_v ();
int v1,v2,v3;
V1=c1.get_v ();
V2=c2.get_v ();
V3=c3.get_v ();
cout<<v1<< "<<v2<<" <<V3<<ENDL;
return 0;
}