complete the following tasks in C++ code:
#include <iostream> using namespace std; class Cube{
public: Cube(int, int,int); int getVolume();
private: int height; int weight; int depth;
}; Cube::Cube(int h, int w, int l) {
height = h; weight = w; depth = l;
}
int main(){
}
#include <iostream> using namespace std; class Cube { public: Cube(int, int, int); int getVolume(); private: int height; int weight; int depth; }; Cube::Cube(int h, int w, int l) { height = h; weight = w; depth = l; } int Cube::getVolume() { return height * weight * depth; } int main() { int h, w, l; cout << "Enter height of cube: "; cin >> h; cout << "Enter width of cube: "; cin >> w; cout << "Enter length of cube: "; cin >> l; Cube c(h, w, l); cout << "Volume of the cube is " << c.getVolume() << endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.