Practical No 10oop Manual
Practical No 10oop Manual
Q.Write a program to find area of circle using OOP.The value of the radius must be
accepted from the user in the main program and pass to the parameterized
constructor and the class circle have two inline function. 1.compute() 2.display()
#include<iostream.h>
#include<conio.h>
class circle
{
public:
float r,a;
circle(float x)
{
r=x;
}
void compute();
void display();
};
inline void circle :: compute()
{
a=3.14*r*r;
}
inline void circle :: display()
{
cout<<"Area of circle:"<<a;
}
void main()
{
int p;
cout<<"\n Enter the radius:";
cin>>p;
circle c (p);
c.compute();
c.display();
getch();
}
OUTPUT:-