//Default Constructor
#include<conio.h>
#include<iostream.h>
class area
{
int l,b;
public:
area()
{
cout<<"Enter length of rectangle: ";
cin>>l;
cout<<"Enter breadth of rectangle: ";
cin>>b;
}
void display()
{
cout<<"Area is: "<<l*b;
}
};
void main()
{
clrscr();
area a1;
a1.display();
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.