# C++ Inline Function Area of Circle

By | March 6, 2020

## C ++ Inline Function Area of Circle

Task: Write down a C++ program to use an inline function named Area(). This function will calculate and return the area of a circle. The radius of the circle is a parameter to the Area() function.

## How this program with Inline Function Works?

First of all we will write a main function in C++. The user will provide an input called radius of the circle. The main function will pass the radius to the inline function as parameter. The function Area() will accept the parameter and calculate the area of the circle by using the following formula:

### Formula for calcuating Area of Circle

area of circle = 3.1415 x radius2

### The C++ expression for the above formula is as follows:

Because we use * for multiplication in C++ programming language.

### The source code for Inline function program in C++

```// C++ Program to show use of Inline
// functions
// calculate area of circle
#include<iostream>

using namespace std;

{
}
int main()
{

cout<<"Area of circle using Inline Function is : "<<Area(radius);
return 0;

}

/*
OUTPUT of the program Inline Functions in C++
Area of circle using Inline Function is : 86.5876
--------------------------------
Process exited after 28.59 seconds with return value 0
Press any key to continue . . .

*/
```

### Out put from another sample run

Area of circle using Inline Function is : 7.71687
——————————–
Process exited after 10.9 seconds with return value 0
Press any key to continue . . .

1,986 total views,  8 views today

## 2 thoughts on “C++ Inline Function Area of Circle”

1. Ekonomia Teoria

Thank you, I couldnt figure how to get it right. I tried this and it worked fine for me. Thank you again!