A vector is named grades How can you clear the contents of t

A vector is named \"grades\". How can you clear the contents of this vector?

Solution

if vector is named as grades, we can clear it by using a member function in dimensional arrays

Methods push_back and pop_back insert and remove (respectively) elements at the end of the vector. For situations where we need to insert or remove at an arbitrary position, we have methods remove and remove. We notice that these methods are inefficient with avector (they take linear time, since all the remaining elements from the given position to the end have to be shifted). However, for situations where we must support these operations, class vector does provide the facilities to do so.

Methods insert and remove use iterators (discussed in the ) as parameters to indicate the position at which we want to insert or remove the element(s).

or use the following method :

A vector is named \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site