Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi guys, Please run the program making sure it works before sending it. Its a C+

ID: 674740 • Letter: H

Question

Hi guys, Please run the program making sure it works before sending it. Its a C++ program and it should have to same main fuction below. Thanks.

This purpose of this problem is to work with function overloading. You will write several versions of functions called find_min(), get_input() and print_min(). print_min() and get_input() will be void functions. find_min() will return a value. The functions are as follows:

The first version of print_min() will take one integer argument and print the message "The minimum is <value>. ", where <value> is the contents of the integer argument.

The second version of print_min() will take one double argument and print the message "The minimum is <value>. " with 4 decimal places of precision for <value>.

The first version of find_min() will take two integer arguments and it will return the minimum of the two integers.

The second version of find_min() will take two double arguments and it will return the minimum of the two doubles.

The third version of find_min() will take three integer arguments and it will return the minimum of the three integers.

The first version of get_input() has two by-reference integer arguments. It will prompt the user for two integers and read them into the by-reference parameters.

The second version of get_input() has two by-reference double arguments. It will prompt the user for two doubles and read them into the by-reference parameters.

The third version of get_input() has three by-reference integer arguments. It will prompt the user for three integers and read them into the by-reference parameters.

Use the following main function for this problem:

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
void print_min(int x)
{
cout<<"The minimum value is: "<<x<<endl;
}
void print_min(double x)
{
cout<<"The minimum value is: "<<fixed<<setprecision(4)<<x<<endl;
}
int find_min(int x, int y)
{
if(x < y)
return x;
return y;
}
double find_min(double x, double y)
{
if(x < y)
return x;
return y;
}
int find_min(int x, int y, int z)
{
if(x < y)
{
if(x < z)
return x;
else
return z;
}
else
{
if(y < z)
return y;
else
return z;
}
}
void get_input(int &x, int &y)
{
cout<<"Enter two integers: ";
cin>>x>>y;
}
void get_input(double &x, double &y)
{
cout<<"Enter two doubles: ";
cin>>x>>y;
}
void get_input(int &x, int &y, int &z)
{
cout<<"Enter three integers: ";
cin>>x>>y>>z;
}   
int main()
{
int num1, num2, num3;
double dnum1, dnum2;

// Two integer version
get_input(num1, num2);
print_min(find_min(num1, num2));

// Two double version
get_input(dnum1, dnum2);
print_min(find_min(dnum1, dnum2));

// Three integer version
get_input(num1, num2, num3);
print_min(find_min(num1, num2, num3));

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote