-
Notifications
You must be signed in to change notification settings - Fork 0
/
area_and_vol.cpp
52 lines (38 loc) · 980 Bytes
/
area_and_vol.cpp
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
//wap in c++ program to calculate vol of box and area of triangle
#include<iostream>
using namespace std;
class volandarea
{
private:
float length,breadth,height,vol,area;
public:
void volume()
{
cout<<"\n\nTo find the vol of the box...";
cout<<"\nenter length of the box : ";
cin>>length;
cout<<"enter breadth of the box : ";
cin>>breadth;
cout<<"enter height of the box : ";
cin>>height;
vol=length*breadth*height;
cout<<"volume of the box is : "<<vol;
}
void Area()
{
cout<<"\n\nTo find the area of the triangle...";
cout<<"\n enter the base length : ";
cin>>length;
cout<<"enter height of the triangle : ";
cin>>height;
area= 0.5*length*breadth;
cout<<"area of triangle is : "<<area;
}
};
int main()
{
volandarea v1,a1;
v1.volume();
a1.Area();
return 0;
}