Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please utilize C++ to answer the questions 1. Given that an array of int named a

ID: 3626566 • Letter: P

Question


Please utilize C++ to answer the questions

1. Given that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 2 and 8.

Assign 22 to the element just before a[k] .
2.
Given that an vector of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6.

Assign 9 to the element just after a[k] .

3. Given that an vector of int named a has been declared, and that the integer variable n contains the number of elements of the vector a , assign -1 to the last element in a .


Please do not use a member function in your solution to this problem.

Explanation / Answer

1. a[k-1] = 22; 2. a[k+1] = 9; 3. a[n] = -1;