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

Popular posts from this blog

Karnataka I PUC Computer Science 2024 Study Material | SECOND PUC HANDBOOK EXAM 2025

PYTHON: Tips and Tricks