Question: Let A be an array of n elements. Write a template function that takes an unsorted array of type and its length as parameters. The

Let A be an array of n elements. Write a template function that takes an unsorted array of type and its length as parameters. The template function should print out the minimum value and the maximum value in the array. For example, if A={1, 2, 3, 4}, then the template function should output:

Minimum value = 1 Maximum value = 4

Assume the operator < and > are defined for the class T. You must write all functions you call. You also need to write a main() to test the following data arrays:

1 7 3 4 6

4 1 19 3 6 2

4.1 3.1 2.2 6.3 7.9

C d a e x

You may store the above data in an array or several arrays without asking users input from keyboard. For a char array, the value of each char is judged on the basis of alphabetical order in ASCII table (see www.ascii-table.com). With the char array, your template function should output two letters: one represents the letter that is located at the front position in the ascii table, while the second letter appears at the last position in the ascii table among all the char array elements. For instance, if A={C, d, a, e, x}, then your function should print out

Minimum value = C Maximum value = x

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!