#include #include #include #include using namespace std; #define V_SIZE 10 // #define the vector size here int main() { // Create three vectors and allocate their size vector u(V_SIZE); vector v(V_SIZE); vector w(V_SIZE); // Populate vectors u & v with integers for(int i = 0; i < V_SIZE; i++) { u[i] = i; v[i] = i; w[i] = u[i] + v[i]; } cout << "The first vector contains: "; // Print the contents of the vector for(int i = 0; i < u.size(); i++) cout << u[i] << ", "; cout << endl; cout << "The second vector contains: "; // Print the contents of the vector for(int i = 0; i < v.size(); i++) cout << v[i] << ", "; cout << endl; cout << "The third vector contains: "; // Print the contents of the vector for(int i = 0; i < w.size(); i++) cout << w[i] << ", "; cout << endl; return 0; } #include #include #include #include using namespace std; int main() { // Create three vectors vector u; vector v; vector w; // Populate vectors u & v with integers for(int i = 0; i < 10; i++) { u.push_back(i); v.push_back(i); w[i] = u[i] + v[i]; } cout << "The first vector contains: "; // Print the contents of the vector for(int i = 0; i < u.size(); i++) cout << u[i] << ", "; cout << endl; cout << "The second vector contains: "; // Print the contents of the vector for(int i = 0; i < v.size(); i++) cout << v[i] << ", "; cout << endl; cout << "The third vector contains: "; // Print the contents of the vector for(int i = 0; i < w.size(); i++) cout << w[i] << ", "; cout << endl; return 0; }