Question: write a Sort a vector Define a function named SortVector that takes a vector of integers as a parameter. Function SortVector() modifies the vector parameter
write a Sort a vector
Define a function named SortVector that takes a vector of integers as a parameter. Function SortVector() modifies the vector parameter by sorting the elements in descending order (highest to lowest). Then write a main program that reads a list of integers from input, stores the integers in a vector, calls SortVector(), and outputs the sorted vector. The first input integer indicates how many numbers are in the list.
Ex: If the input is:
5 10 4 39 12 2 the output is:
39,12,10,4,2, For coding simplicity, follow every output value by a comma, including the last one.
Your program must define and call the following function: void SortVector(vector& myVec)
#include #include using namespace std;
/* Define your function here */
int main() {
/* Type your code here */
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
