First page Back Continue Last page Graphics
VECTOR (cont.)
push_back member function
- Appends a new element to the end of the vector
- As a side effect, it increases the size of the vector by 1
homework.push_back(x);
- Adds x to the end of the vector.
If you need to save the size
- typedef vector<double>::size_type vec_sz;
- vec_sz size = homework.size();
- (FOR PORTABILITY)