Given that a 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.

LANGUAGE:  C++

CHALLENGE:

Given that a 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.

SOLUTION:


a[n-1]=-1;