-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask2.cpp
More file actions
53 lines (44 loc) · 716 Bytes
/
task2.cpp
File metadata and controls
53 lines (44 loc) · 716 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
using namespace std;
struct cuboid
{
private:
int l,b,h;
public:
void setdata(int x,int y,int z)
{
l=x;
b=y;
h=z;
}
void show()
{
cout << "Length = " << l << endl;
cout << "Breadth = " << b << endl;
cout << "Height = " << h << endl;
}
void area()
{
cout << "Area = " << 2*(l*b+b*h+h*l) << endl;
}
void volume()
{
cout << "Volume = " << l*b*h;
}
};
int main()
{
struct cuboid c1;
int a,b,c;
cout << "Enter length - ";
cin >> a;
cout << "Enter breadth - ";
cin >> b;
cout << "Enter height - ";
cin >> c;
c1.setdata(a,b,c);
c1.show();
c1.area();
c1.volume();
return 0;
}