C++ program: Inline function
// 10 C++ program - Find cube of a number using inline function.
#include<iostream.h>
#include<conio.h>
class InlineDemo
{
public:
inline int cube(int a) //Inline function definition
{
return a*a*a;
}
};
void main() //Main Function
{
int n;
InlineDemo i;
clrscr( );
cout<<"Enter the input number"<<endl;
cin>>n;
cout<<"Cube of"<<" = "<<i.cube(n); //Inline function call
getch( );
}
Comments
Post a Comment