Question
Must be done in C++, please, and thank you. Comments that help in explaining are appreciated! Write a function called max that returns the max
Must be done in C++, please, and thank you. Comments that help in explaining are appreciated! Write a function called max that returns the max of two int numbers. Then, create a series of overloaded functions with the same name that can Return the max of three int numbers. Return the max of an array of int a[5]. Return the max of two arrays: int a[5], int b[5]. Please test the functions using the main function code that I have provided without changing it. Thanks again!
The main:
#include
int main()
{ cout << "The-Question:" << endl;
cout << "The max of 9 and 7 is " << max(9, 7) << endl;
cout << "The max of 9, 15, and 17 is " << max(9, 15, 17) << endl;
int arrayOne[ARRAY_LENGTH] = { 10,2,30,4,15 }; cout << "The max of the array {10, 2, 30, 4, 15} is " << max(arrayOne) << endl;
int arrayTwo[ARRAY_LENGTH] = { 8,70,16,15,14 }; cout << "The max of the two given arrays is " << max(arrayOne, arrayTwo) << endl;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started