Question: Starting out with C++ Early Objects: Chapter 16 Programming Challenge #5 The two sets of output below (pg. 1019) show the results of successive circular
Starting out with C++ Early Objects: Chapter 16 Programming Challenge #5
The two sets of output below (pg. 1019) show the results of successive circular rotations of a vector. One set of data is for a vector of integers, and the second is a vector of strings.
Write two template functions that can be used to rotate and output a vector of a generic type:
void rotateLeft(vector
The first function performs a single circular left rotation on a vector, and the second prints out the vector passed to it as parameter. Write a suitable driver program that will allow you to test the two functions by generating output similar to the above. Verify that the program works with vectors whose element types are char, int, double and string.
Starting out with C++ Early Objects: Chapter 16 Programming Challenge #6
Write a template function that takes as parameter a vector of a generic type and reverses the order of elements in the vector, and then add the function to the program you wrote for Programming Challenge 5. Modify the driver program to test the new function by reversing and outputting vectors whose element types are char, int, double and string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
