C++ Programming Blog

 
 
 
#include<iostream.h>
#include<conio.h>
int &max(int &a,int &b,int &c)
{
    if(a>b&&a>c)
        return a;
    else if(b>a&&b>c)
        return b;
    else
        return c;
}

main()
{
    clrscr();
    int a,b,c;
    cout<<\"Please enter the value for a and b:\";
    cin>>a>>b>>c;
    cout<<\"Maximum is :\"<<max(a,b,c)<<\"\\n\";
}

 
 
Didn't find what you were looking for? Find more on Program that provides an example of return by reference from functions