1. Enter:
vector<int> a,b;
for(int i = 0; i < n; i++)
Use with scanf ( "% d", & a [i]) to the input value when the container;
Or a [i] = b [i] time;
You need to use a resize () specifies the size or capacity of the container when a predetermined range defined vector vessel;
2.vector range:
Define global variables n eg const int maxsize 500;
Global variables n
vector <int> (maxsize) to compile (priority memory defines a global variable)
vector <int> (n) to compile (global variable defined specific value of n, operational errors)
3. vector<int> a[maxsize] (vector<vector<int>> a[maxsize])
By assigning push_back (); assignment
a (n); // define the vector in the array after the specified range is not consistent with c ++ rules, initialize the array range (container) only when defining
4. When the donor element is added to the structure with no vector 1. {constructor initializes a structure variable according to the variable in the sequence}
2. the name of the structure (local variable sequence construction methods) in the presence constructor
initialization vector containers of questions:
vector a;
1. The two vessels are equal path = pre; // path1 = pre, first deletes all of the elements of vect, then all the elements vect2
Difference 2.a.resize (n), reverse (n), (n) of
resize (n) and (n): the value of the initialization container is 0 (when Pushback () 0 already present in the container), reverse the (value does not exist when the container Pushback ()) is null initialization container
//https://blog.csdn.net/zjm750617105/article/details/62426843?utm_source=blogxgwz5