Write a program to add two number using inline function in C++?



#include<iostream.h>
#include<conio.h>
class bca
{
 public:
 inline int sum(int x, int y)
 {
 return(x+y);
 }
};
int main()
{
clrscr();
int r,a,b;
bca obj;
cout<<"enter two integers :"<<endl;
cin>>a>>b;
r=obj.sum(a,b);
cout<<" the sum of two integers is :"<<r<<endl;
getch();
return 0;
}
 





OUTPUT:-

enter two integers :   3   6
the sum of two integer is :  9
 

Comments

Post a Comment

Popular posts from this blog

Traversing of elements program with algorithm and Flowchart