### Convert upstream results to vector and sort problem!

My output from upstream program is as follow:

10 2 3 34 55 65 67 76 23
56 9 5 29 19 29 19 29 19
56 23 23 43 45 12 56 43 12
100 234 123 12 12 34 32 45 46
.
.

The my work is: Add the 10th column according to some criteria. Then sort based on the 10th column.

example as follow: add 10th column.

10 2 3 34 55 65 67 76 23 1
56 9 5 29 19 29 19 29 19 3
30 23 23 43 45 12 56 43 12 2
45 9 10 29 19 29 9 19 29 3
100 234 123 12 12 34 32 45 46 4

And should be sorted based on the last column (10th column)
example as follow: which is sorted

10 2 3 34 55 65 67 76 23 1
30 23 23 43 45 12 56 43 12 2
45 9 10 29 19 29 9 19 29 3
56 9 5 29 19 29 19 29 19 3
100 234 123 12 12 34 32 45 46 4

I tried with a vector!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384`` ``````#include #include using namespace std; int main () { int main() { std::vector > ph; std::vector p; // here I have a program which will generate the matrix row by row for (int j=0; j<=tr; j++) // this loop is from above program part and gives the value of nine verticies of triangle in each loop! // depending on the following if conditions the tenth vector is added if ((x1<20) && (z1<62)) { p.push_back(x1); p.push_back(y1); p.push_back(z1); p.push_back(x2); p.push_back(y2); p.push_back(z2); p.push_back(x3); p.push_back(y3); p.push_back(z3); p.push_back(1); ph.push_back(p); } if ((20<=x1<=40)&& (z1<60)) { p.push_back(x1); p.push_back(y1); p.push_back(z1); p.push_back(x2); p.push_back(y2); p.push_back(z2); p.push_back(x3); p.push_back(y3); p.push_back(z3); p.push_back(2); ph.push_back(p); } if((40

// I have no syntax error but, the loop doesn't work, it stops just after excuting the first loop!

What is the problem, would you please recommend!

Regards
Topic archived. No new replies allowed.