Question: Using template to define a class which has two member functions: sorting () and max_min_mean(). The 1st function take an array parameter in template data

 Using template to define a class which has two member functions:

Using template to define a class which has two member functions: sorting () and max_min_mean(). The 1st function take an array parameter in template data type and sorts the data, the 2nd function also take an array parameter in template data type and find the max, min, and mean values of the array and print them. In main(), declare one int array and one double array and assign the array with integer and real numbers, then declare two object variables using the class defined above and initialize one's template type to int and the other to double. After that, complete: (1) use the first object variable's member function sort() to sort the int array and print the sorted result, and then use the first object variable's member function max_min_mean() to output the three key values of the int array; use the 2nd object variable's member function sort() and max_min_mean() to do the same as in to the double array; (note, you can choose either bubble or selection sort)

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!