0
Are there any problems with the c++ code
vector<int> vec1 = {5, 2, 5, 2, 0}; vector<int> vec2; for(int i = 0; i < vec1.size(); ++i) vec2[i] = vec1[i];
2 RĂ©ponses
+ 3
Moreover, I saw the second vector's size isn't defined. So, in your loop, write :
vec2.push_back(vec1[i])
+ 1
you need to include vector library first to work with vectors:
#include <vector>
Then everything will be fine!âș