Question: Write a program that takes as input an integer array. The input starts with an integer indicating the number of integers that follow and reads
Write a program that takes as input an integer array. The input starts with an integer indicating the number of integers that follow and
reads these values into an array. The program then swaps the maximum and minimum values in the array and prints out the new array.
You can safely assume that the number of integers in the array is always less than or equal to You can also assume there are NO
repeated numbers in the array.
Ex: if the input is
then the program will output
You MUST define the following function to get the user input
void Getinputint data int &nVals;
You MUST define the following function to swap the maximum and minimum values in the array and return the new array
void SwapMaxminint data int nVals;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
