1. Write a complete program that transfers values from vectors V1 and V2 to each other, as presented in the figure below. The figure presents values from V1 vector copied to V2 vector. It also presents values from V2 vector copied to V1 vector. The arrows present values being passed to each vector. You must use pointer offsets in the program. (hint: When you do v1.data(), it returns a pointer to the first element of the vector, and then you can use pointer arithmetic to access the elements.) V1 0 0 0 4 5 V2 1 2 3 0 0 0

icon
Related questions
Question
1. Write a complete program that transfers values from vectors V1
and V2 to each other, as presented in the figure below. The figure
presents values from V1 vector copied to V2 vector. It also
presents values from V2 vector copied to V1 vector. The arrows
present values being passed to each vector. You must use pointer
offsets in the program. (hint: When you do v1.data(), it returns a
pointer to the first element of the vector, and then you can use
pointer arithmetic to access the elements.)
V1
0
0
0
4
5
V2
1
2
3
0
0
0
Transcribed Image Text:1. Write a complete program that transfers values from vectors V1 and V2 to each other, as presented in the figure below. The figure presents values from V1 vector copied to V2 vector. It also presents values from V2 vector copied to V1 vector. The arrows present values being passed to each vector. You must use pointer offsets in the program. (hint: When you do v1.data(), it returns a pointer to the first element of the vector, and then you can use pointer arithmetic to access the elements.) V1 0 0 0 4 5 V2 1 2 3 0 0 0
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer