Professional Documents
Culture Documents
Multiple Classess
Multiple Classess
int main()
{
}
//This is c++ code which demonstrate multiple classess and objects for calculating area of circle and
triangle
#include <iostream>
public:
void gethightbase()
{
cout<<"Please enter the base and hight=>"<<endl;
cin>>base>>height;
}
void showtrianglearea()
{
trianglearea=0.5*base*height;
public:
void getredious()
{
cout<<"Please enter the radious value =>"<<endl;
cin>>r;
}
void showcirclearea()
{
circlearea=3.14*r*r;
int main()
{
triangle t1;
t1.gethightbase();
t1.showtrianglearea();
circle c1;
c1.getredious();
c1.showcirclearea();