Question: in c plus Given the definitions of main ( ) , Read ( ) and Write ( ) , complete main.cpp by implementing the following
in c plus Given the definitions of main Read and Write complete main.cpp by implementing the following member functions:
template vector GetStatisticsvector& list
Take a vector template as a parameter
Store the minimum, median, and maximum values of the vector parameter into a new vector
Return the new vector
template void Runvector& list
Take a vector template as a parameter
Call Read with the vector parameter as an argument. Read stores input values into the vector parameter
Sort the vector parameter
Call Write to output the sorted vector
Output a new line
Call GetStatistics with the sorted vector as an argument. GetStatistics returns a vector containing the minimum, median, and the maximum values of the sorted vector
Call Write to output the vector returned by GetStatistics
Output a new line
Note: vector.size returns a long unsigned int, not an int.
Hint: Use the builtin sort function to sort a vector.
Ex: If the input is:
one two three four five
the output is:
five four one three two
five one two
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
