I made a little program in which i read double values from file and store them in vector of vectors. So i have one vector pairs which is collection of coordinates (numbers from one line in txt file) and vector trajectories which is vector of vectors pairs (collection of all paths). Now i need to calculate Euclidean distance (http://en.wikipedia.org/wiki/Euclidean_distance) for all paths and find the shortest path. I'm not too familiar with c++ so i don't know how to pass vector with index (vector[x]) as function argument. I meant to do something like this:
double distance (Paths path[i]) {
double dist, tmp;
for (Dots::size_type j=0; j<path[i].size[];j++) {
tmp += pow((path[i][j].xt - path[i][++j].xt),2) + pow((path[i][j].yt - path[i][++j].yt),2);
}
dist = sqrt(tmp);
return dist;
but while compiling i get that i and path isn't declared in this scope. So my first question is how can i pass this to function as argument. The second question is how can i solve the situation with j counter in the calculation line (i'm sure that i did something wrong with it) because i'm increasing it's value once in the for condition and twice in the calculation line. Thank you all in advance.