I am resubmitting this question because the first answer I r
I am resubmitting this question, because the first answer I received did not use the function names of inputValues, max, and outputResults as requested. Please make sure the C++ program reflects all of the required funtion names.
Write a C++ program that has a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example if 7 and 12 are passed as arguments to the function, the function should return 12. Use another function to get your input. Call it inputValues. The main program first calls inputValues and then max. Finally have a third function outputResults that echoes the input and displays the maximum value of the two inputs. Use -9 and -17 as input.
Use mnemonic names for all identifiers. The names of the identifiers should suggest the use of the identifier. Use Camel casing. Variables should be initialized when used. Use named constants that are capitalized and underscored multiword constants. All input values must be echoed and labeled in a readable manner.
Solution
#include <iostream>
#include <math.h>
using namespace std;
int max(int a,int b)
{
return a>b?a:b;
}
void inputValues(int &a,int &b)
{
cout << \"Input value of first integer : \";
cin >> a;
cout << \"Input value of second integer : \";
cin >> b;
}
void outputResults(int a,int b,int max)
{
cout << \"Maximum value between a = \" << a << \" b = \" << b << \" is : \" << max;
}
int main() {
int a,b;
inputValues(a,b);
int maximum = max(a,b);
outputResults(a,b,maximum);
return 0;
}
