Question: write a simple C++ program that has the following 3 functions involving vectors : 1. Function that reads 10 integer values into a vector, determines
write a simple C++ program that has the following 3 functions involving vectors :
1. Function that reads 10 integer values into a vector, determines the smallest value and the largest value, prints the vector to the screen and then prints the smallest and largest elements beside it.
2. Function that reads 20 integer values into 2 10 element vectors and loops through both vectors one element at a time, adding and multiplying the corresponding values together. Save the results into a 3rd and 4th ten element vector , one to store the sums and one to store the products. Then, print all the values in all 4 vectors.
3. A function that will read 10 integer values into a vector , prompt the user to specify how many times it should right rotate the elements in a cyclical fashion , and then perform the rotation and output the vector. For example if the vector input is
1 2 3 4 5 6 7 8 9 10
And the number of rotations is 3
Then the output should be
8 9 10 1 2 3 4 5 6 7.
These 3 should be implemented as functions. The main function should contain only 3 lines of code, to call the other functions described. They should use a return type of void.
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
