COPY THIS AND PASTE NOTEPADE FILE AND SAVE AS AREA.CPP AND RUN IT IN DEVC++ OR DOS BOX (FOR EINDOW 7 )
MS DOS FOR XP USER AND VISTA ALSO
#include<iostream.h>
#include<conio.h>
class calculate
{
public:
int l,b;
void display();
void area(void);
void parameter(void);
};
void calculate::display()
{
cout<<"Enter the length:-";
cin>>l;
cout<<"Enter the breadth:-";
cin>>b;
}
void calculate::area(void)
{
float area;
area=l*b;
cout<<area<<endl;
}
void calculate::parameter(void)
{
float parameter;
parameter=2*(l+b);
cout<<parameter<<endl;
}
void main()
{
clrscr();
calculate c;
c.display();
c.area();
c.parameter();
getch();
}
/*Output:-
Enter the length:-25
Enter the breadth:-45
1125
140*/
No comments:
Post a Comment