Can you help me with the following exercise?
The idea is to have 3 functions with 3 vectors, vector 1 enters even numbers, vector 2 enters odd numbers and vector 3 multiplies each value of vector 1 with vector 2. In the end, the 3 vectors are displayed. The problem is that for vector 3 I do not have as reference vectors 1 and 2, and therefore does not perform multiplication. This is what I have so far:
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
using std::setw;
vectorpar (vector<int>numerospares) {
int size1;
for (int i = 1; i <= 20; i++) {
if (i % 2 ==0)
numerospares.push_back(i);
}
size1 = numerospares.size();
for(int j = 0; j< size1; j++) {
cout << setw(3) << numerospares[j] << endl;
}
}
vectorimpar (vector<int> numerosimpares) {
int size2;
for (int i = 1; i <= 20; i++) {
if (i % 2 !=0)
numerosimpares.push_back(i);
}
size2 = numerosimpares.size();
for(int j = 0; j< size2; j++) {
cout << setw(3) << numerosimpares[j] << endl;
}
}
parximpar (vector<int> paresximpares) {
vector <int>numerospares;
vector <int>numerosimpares;
//int size3 = numerospares.size();
for (int i = 0; i < 20; i++) {
vectorpar (numerospares)[i] * vectorimpar (numerosimpares)[i];
}
}
int main() {
vector <int>numerospares;
vector <int>numerosimpares;
vector <int>paresximpares;
cout<<"El arreglo de pares es:"<<endl;
vectorpar (numerospares);
cout<<"El arreglo de impares es:"<<endl;
vectorimpar (numerosimpares);
cout<<"El producto de los arreglos es:"<<endl;
vectorparximpar (paresximpares);
return 0;
}