Saturday 4 January 2014

Inline functions

//An inline function is a function that replaces function call with corresponding code

#include<iostream.h>
#include<conio.h>
inline int mul(int a,int b)
{
 return(a*b);
}
inline int div(int a,int b)
{
 return(a/b);
}
void main()
{
int a,b;
clrscr();
cout<<"Enter two integers.";
cin>>a>>b;
cout<<"product of a and b is:"<<mul(a,b)<<"\n";
cout<<"quotient of a and b is:"<<div(a,b)<<"\n";
getch();
}

No comments:

Post a Comment