Write a C++ program to find the largest of three numbers using inline function.
#include<iostream.h>
#include<conio.h>
inline int largest(int &a,int &b,int &c)
{
int big=0;
if(a>b)
big=a;
else
big=b;
if(c>big)
big=c;
return big;
}
int main()
{
int a,b,c;
clrscr();
cout<<"Enter Three Numbers To Find The Largest "<<endl;
cout<<"a = ";
cin>>a;
cout<<"\nb = ";
cin>>b;
cout<<"\nc = ";
cin>>c;
int large=largest(a,b,c);
cout<<"\n Largest of "<<a<<","<<b<<" and "<<c<<" is "<<large;
getch();
return(0);
}
Enter Three Numbers To Find The Largest
a = 24
b = 45
c = 23
Largest of 24,45 and 23 is 45
Thanks
Mukesh Rajput
Post A Comment:
0 comments: