I'm attempting to create a program that will multiply 3 not equal values from vector 1 ('V1'), and write in vector 2 ('V2'). I'm using 3 'for' loops and an integer that counts vector 2's value's number. But program skips the 'if' statement.

```
#include <vector>
#include<fstream>
#include<iostream>
#include <algorithm>

using namespace std;

void earase(vector<int> V2, unsigned int z){
    V2.erase(V2.begin() + z);
}

void main(){
unsigned int N;
unsigned int z = 0;
vector<int> V1;
vector<int> V2;
int input;
ifstream file1;
file1.open("input.txt");
file1 >> N;

for (unsigned int i = 0; i < N; i++){
    file1 >> input;
    V1.push_back(input);
}
file1.close();

for (unsigned int i = 0; i < V1.size(); i++){
    for (unsigned int j = 0; j < V1.size(); j++){
        for (unsigned int k = 0; k < V1.size(); k++){
            V2.push_back(V1[i] * V1[j] * V1[k]);
            if (i == j || i == k || j == k || (i == k ) && k==j)
            {
                void earase(vector<int> V2, unsigned int z);
            }
            z++;
        }
    }
}

sort(V2.begin(), V2.end());

ofstream file2;
file2.open("output.txt");
file2 << V2.back();
file2.close();
}

```

Here is the input.txt file

```
4
1 2 3 4

```

After finishing the program sorts the vector 2 and writes the last number in vector 2 in 'output.txt' but it writes values that will come only if multiply the same value from vector 1, 3 times.

I think the problem is in 'if' statement, and 'z' integer, is there any more efficient way to do this?