Answer :
To assign the value 99 to the last element of a vector with 15 elements in C++, use the syntax myvector[14] = 99; since vector indexing is zero-based.
The question refers to the C++ STL vector class and asks how to assign the value 99 to the last element of a vector that has been initialized with a size of 15. In C++, vector indexing is zero-based, meaning that the first element is at index 0, the second element is at index 1, and so on up to the last element, which is at index size - 1. Therefore, for a vector with 15 elements, the last element is at index 14.
To correctly assign the value 99 to the last element of the vector myvector, we use the following syntax: myvector[14] = 99;