c++ equivalent to python append method for lists -
i'm learning c++ coming background in python.
i'm wondering there way append items list in c++?
mylist = [] in range(10): mylist.append(i)
is there in c++ can array?
you need vector, this:
#include <vector> void funct() { std::vector<int> mylist; for(int = 0; < 10; i++) mylist.push_back(10); }
see http://cplusplus.com/reference/stl/vector/ more information.
Comments
Post a Comment