Introduction to vectors
C++ Vector
C++ vector iis a type of container (like an array) that allows the storage of multipe elements(number,strings,object etc).
emmmmm…vector 看作是个小篮子
Quick Review
- vector nums; ----float
- nums.push_back(10.5); —末尾添加
- cout << nums[0] << endl; ----打印pos0
- nums.erase( nums.begin() ); ----删除vector的第一个元素
- cout << nums.size() << endl; ----打印vector元素
- vector:: iterator it = nums.begin(); 为begin vector一个创建inerator
- cout << *it << endl;----打印inerator的元素指
Declaring a vector
类型+名称
vector measures;
vector surnames;
vector particles;
https://openframeworks.cc/ofBook/chapters/stl_vector.html