#include<iostream>
#include<string>
usingnamespacestd;
class shape
{
private:
inta,b;
public:
shape()
{
a = b = 0;
}
voidsetvalues()
{
cout<<"Enter the values for breath and height:"<<endl;
cin>> a; cin>> b;
}
floatarea_r()
{
float arear = (a*b);
return arear;
}
floatarea_t()
{
floatareat = (a*b) / 2;
returnareat;
}
voidgetvalues(int x, int y)
{
x=a;
y=b;
}
};
voiddisp(int, int, float);
int main()
{
shapevar;
intm,n;
stringt,r,e,c;
cout<<"Enter your choice (T) for Triangle and (R) for Rectangle and (E) to Exit:"<<endl;
getline (cin,c);
do
{
if (c==t)
{ var.setvalues(); var.area_t(); var.getvalues(m,n); disp(m,n, var.area_t());}
elseif (c==r)
{var.setvalues(); var.area_r(); var.getvalues(m,n); disp(m,n, var.area_r()); }
} while (c!=e);
system("PAUSE");
return 0;
}
voiddisp(inta,int b, float c)
{
cout<<"The values entered are:"<<endl;
cout<< a << b;
cout<<"The area is:"<<endl;
cout<< c;
}