Question: improve (Re-write ) the following program by using the function overloading. ( in C++ ) #include using namespace std; int maximumInt( int value1, int value2,

improve (Re-write ) the following program by using the function overloading.

( in C++ )

#include using namespace std; int maximumInt( int value1, int value2, int value3 ) { int max = value1; if ( value2 > max ) max = value2; if ( value3 > max ) max = value3; return max; } double maximumDouble( double value1, double value2, double value3 ) { double max = value1; if ( value2 > max ) max = value2; if ( value3 > max ) max = value3; return max; } char maximumChar( char value1, char value2, char value3 ) { char max = value1; if ( value2 > max ) max = value2; if ( value3 > max ) max = value3; return max; } int main() { int int1, int2, int3; cout << "Input three integer values: "; cin >> int1 >> int2 >> int3; cout << "The maximum integer value is: " << maximumInt( int1, int2, int3 ); double double1, double2, double3; cout << " Input three double values: "; cin >> double1 >> double2 >> double3; cout << "The maximum double value is: " << maximumDouble( double1, double2, double3 ); char char1, char2, char3; cout << " Input three characters: "; cin >> char1 >> char2 >> char3; cout << "The maximum character value is: " << maximumChar( char1, char2, char3 ) << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!