Skip to content

C++ Program to Demonstrate inline Function

C++ Program to Demonstrate inline Function

Code:

/*C++ Program to Demonstrate inline Function*/
#include<iostream.h>
#include<conio.h>

class line
{
 public:
 inline float multi(int x, int y)
 { return (x*y);
 }
 inline float cube(int z)
 { return (z*z*z);
 }
};
void main()
{
  clrscr();
  line obj;
  int val1,val2;
  cout<< “n Enter 2 Numbersn”;
  cin>>  val1 >> val2;
  cout<< ” Multiplication is ” <<obj.multi(val1,val2)<<endl;
  cout<< ” Cube is “<<obj.cube(val1)<<endl;
  getch();
}

Sample Output:


Comment bellow for your Query and Feedback

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!