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

Complete the following vectors utilizing the C++ : 1. Assume v is a vector that

ID: 3626379 • Letter: C

Question

Complete the following vectors utilizing the C++ :

1. Assume v is a vector that has been declared and initialized. Write an expression whose true if there are any values stored in v.

2.Given that an vector of int named a with 30 elements has been declared, assign 5 to its last element.
Please do not use a member function

3. Assume that an vector named a , containing exactly five integers has been declared and initialized.

Write a single statement that adds ten to the value stored in the first element of the vector.

Explanation / Answer

1. v.empty(); empty is a member function of vectors that returns true if there are any values in v, and returns false if there are none 2. v[29] = 5; vectors act like arrays and so you can call individual elements with brackets. Also, like arrays, vector elements start at 0, and so the last element, if there's 30 elements is at 29. 3. a[0] = a[0] + 10; the first element again starts at 0 so just call the first element, add ten to it, then set the first element as that sum.