Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program that provides an example of return by reference from functions

Posted By: Holly Brown     Category: C++ Programming     Views: 3427

Write a program that provides an example of return by reference from functions.

Code for Program that provides an example of return by reference from functions in C++ Programming

#include<iostream.h>
#include<conio.h>
int &max(int &a,int &b,int &c)
{
    if(a>b&&a>c)
        return a;
    elseif(b>a&&b>c)
        return b;
    elsereturn 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";
}
  
Share: 



Holly Brown
Holly Brown author of Program that provides an example of return by reference from functions is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!