Vector's size as a number of elements, can be obtained through a .size()
member function:.
#include <iostream>
#include <vector>
int main() //from w ww. ja v a 2s . co m
{
std::vector<int> v = { 1, 2, 3, 4, 5 };
std::cout << "The vector's size is: " << v.size();
}