forked from zmercury/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolumeCuboid.cpp
More file actions
34 lines (27 loc) · 760 Bytes
/
Copy pathvolumeCuboid.cpp
File metadata and controls
34 lines (27 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
using namespace std;
class volumeCuboid {
public:
int length;
int height;
int width;
int volumeOfCuboid;
void readData() {
cout << "Enter the length of the cuboid: ";
cin >> length;
cout << "Enter the height of the cuboid: ";
cin >> height;
cout << "Enter the width of the cuboid: ";
cin >> width;
}
void calcVolume() {
volumeOfCuboid = length * height * width;
cout << "The volume of cuboid is " << volumeOfCuboid << " cm3";
}
};
int main() {
volumeCuboid v1;
v1.readData();
v1.calcVolume();
return 0;
}