Sunday, 25 August 2013


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 Numbers\n";
  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

Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment