If the two vectors have the same size, in a while loop, test that each successive pair of elements is equal.
bool is_equal(vector<int> a1, vector<int> a2)
{
if (a1.size() != a2.size()) return false;
int i;
for (i = 0; i < a1.size(); i++)
if (a1[i] != a2[i]) return false;
return true;
}
Use the assignment statement.
vector<int> a(2); vector<int> b(4); . . . a = b;
Assign 0 to each element in the array.
for (int i = 0; i < a.size(); i++)
a[i] = 0;
Assign an empty vector of the same type to an existing vector.
vector<int> a(2); . . . a = vector<int>(); // empty a