C++ program to demonstrate INLINE FUNCTION to calculate area of a circle from its radius
#include <iostream>
#define PI 3.1416
using namespace std;
inline float area(float r)
{
return PI*r*r;
}
int main()
{
float r;
cout<<"Enter radius of a circle: ";
cin>>r;
cout<<"Area of the circle is "<<area(r);
return 0;
}
No comments:
Post a Comment