#include <iostream.h>
class area{
private:
int x,y,avg;
public:
area(){ //constructor
setdata();
getdata();
}
void setdata(){
cout<<"Enter length of the area: "<<endl;
cin>>x;
cout<<"Enter wedth of th area: "<<endl;
cin>>y;
}
void getdata(){
avg = x*y;
cout<<"the total area is : "<<avg<<endl;
}
};
void main()
{
area obj1;
}
THE OUTPUT IS .......
class area{
private:
int x,y,avg;
public:
area(){ //constructor
setdata();
getdata();
}
void setdata(){
cout<<"Enter length of the area: "<<endl;
cin>>x;
cout<<"Enter wedth of th area: "<<endl;
cin>>y;
}
void getdata(){
avg = x*y;
cout<<"the total area is : "<<avg<<endl;
}
};
void main()
{
area obj1;
}
THE OUTPUT IS .......
No comments:
Post a Comment