Wednesday, March 23, 2011

Write a program to add three numbers using inline function

# include "iostream"
using namespace std;

# include "stdio.h"

class addition
{


public:

inline int fnAddition(int nOperand1,int nOperand2,int nOperand3)
{
return nOperand1 + nOperand2 + nOperand3;

}


};

int main()
{
// Object created for three number addition
addition Three;

printf("%d\n",Three.fnAddition(2,3,4));

return 0;
}

OUTPUT:

9
Press any key to continue . . .

No comments:

Post a Comment