Question: in basic C++ Write a program that implements the following items. You should write the printVector function ( 4p), which takes a vector and a
in basic C++
Write a program that implements the following items. You should write the printVector function ( 4p), which takes a vector and a vector name as parameters. When completing each item below, you should print the related vector on the terminal. 1. Define two integer vectors named A and B(2p) 2. Add numbers (2,5,8,11,14,17,20,23) to the integer vector A. You should add these numbers to the vector in the loop. (2p) 3. Add numbers (10,100,1000,10000) to the integer vector B. You should add these numbers to the vector in the loop. (2p) 4. Insert 555 as the first element to the vector A(2p) 5. Insert the first three elements of A to the beginning of the B(2p) 6. Erase the second last element of B(2p) 7. Erase the numbers between the second and fifth element of A (second and fifth are inclusive) (2p) 8. Sum the first and the last element of B(2p) The output should be as follows Vector A:258 8114172023 Vector B : 10100100010000 Vector A: 5552581114172023 Vector B : 5552510100100010000 Vector B : 555251010010000 Vector A:555 14172023 555+10000=10555 Write a program that implements the following items. You should write the printVector function ( 4p), which takes a vector and a vector name as parameters. When completing each item below, you should print the related vector on the terminal. 1. Define two integer vectors named A and B(2p) 2. Add numbers (2,5,8,11,14,17,20,23) to the integer vector A. You should add these numbers to the vector in the loop. (2p) 3. Add numbers (10,100,1000,10000) to the integer vector B. You should add these numbers to the vector in the loop. (2p) 4. Insert 555 as the first element to the vector A(2p) 5. Insert the first three elements of A to the beginning of the B(2p) 6. Erase the second last element of B(2p) 7. Erase the numbers between the second and fifth element of A (second and fifth are inclusive) (2p) 8. Sum the first and the last element of B(2p) The output should be as follows Vector A:258 8114172023 Vector B : 10100100010000 Vector A: 5552581114172023 Vector B : 5552510100100010000 Vector B : 555251010010000 Vector A:555 14172023 555+10000=10555
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
