Wednesday, 2 March 2016

Q. Perimeter of a square using constant function ?

THE OUTPUT WOULD BE














#include<iostream.h>
#include<conio.h>
class A
{ int pr,a;
public:
inline void B()
{ cout<<"Enter side=";
 cin>>a;
}
void C() const
{ int p;
 //pr=4*a;
 p=4*a;
 cout<<"Perimeter of square="<<p;
}
};
void main()
{ clrscr();
A obj;
obj.B();
obj.C();
getch();
}

No comments:

Post a Comment