Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions