To obtain the number of elements in a vector, you use the size method:
size
v.size()
Note that size is a method; it is not an instance variable.