calculate area & circumference of circle using Inline Function

C++
Loading...

calculate area & circumference of circle using Inline Function in C++CPP OOP’s In Hindi – Aaj Ham C++ OOPs Me Ek C++ Area And Circumference Program Ko Create Karne Wale Hai.

Also Read – Classes & Object & Data Members Etc

calculate area & circumference of circle using Inline Function

C++ Inline Function in Hindi Ek Aaisa Function Hota Hai Jise Call Karne Par Program Control Us Called Function Me Nhi Jata , Balki Program Control Jaha Par Hota Hai Wahi Par Inline Function Expand Yani ki Copy Code Ho Jata Hai And Program Aapne Normal Flow Me Execute Hota Rahta Hai.

Example:

#include<iostream>
using namespace std;
const int pi=3.14159;
/* Finds circumference of circle*/
inline float circum(float x)
	{ 
		return(2*pi*x);
	}
/* Finds area of circle*/
inline float area(float x)
	{ 
		return(pi*x*x);
	}
int main()
{
float r;cout<<"Enter the radius of the circle:";
cin>>r;
cout<<endl<<"Circumference:"<<circum(r);
cout<<endl<<"Area :"<<area(r);
return 0;
}

Output:

Enter the radius of the circle: 4
Circumference:24
Area:48

Also Read – Swap Numbers Using Friend Function

Aap Upper Output Ko Dekh Kar Program Ko Understand Kar Sakte Hai, isme Hame Functions Create Kiye Hai And Fir Unke Value Ko Input Karaya Hai, Uske Bad Hame Unhe Print Kar Diya Hai |

Leave a Reply

Your email address will not be published.