Analyse the algorithmic complexity of your code
for (int i = 0; i < n; i++){
float x, y, z;
myFile >> x;
myFile >> y;
myFile >> z;
int flag = -1;
for (int j = 0; j < vertexNum; j++){
if (vertex[j][0] == x && vertex[j][1] == y && vertex[j][2] == z){
flag = j;
break;
}
}
if (flag == -1){
vertex[vertexNum][0] = x;
vertex[vertexNum][1] = y;
vertex[vertexNum][2] = z;
vertexNum++;
}
}
As the above, one of the function algorithmic complexity is O(n^2)
And most of them is O(n)
Generally, it is not very efficient.