Multidimensional vectors

@damn_me I am clear with push_back, but I am not very clear with sorting.

https://www.dropbox.com/s/fmass1ub4keixg3/Sorting.cpp?dl=0

I tried the above code to sort based on 1st element, 2nd element and so on.

Input:
3 4 5

2 3 4

1 2 3

1 6 7

1 3 5

Correct output:

1 2 3

1 3 5

1 6 7

2 3 4

3 4 5

My wrong output:

1 2 3

1 2 3

1 2 3

1 2 3

1 2 3

I know the way I have used sort is wrong but I wasn’t able to understand the row number technique you did using map.

@sandy999 See below.

Damn me @damn_me :stuck_out_tongue: Now, maps are super new to me, so I am not familiar with any of the operations on map,. But I am able to get the logic now. If it’s trouble demonstrating the map operations in code like how you did for the original question could you please direct me to a resource which explains these operations well? Then, I’ll try sorting using this logic myself and attach the code. My gratitude is inexpressible. Thanks a lottt!

See this, v27HS0 - Online C++ Compiler & Debugging Tool - Ideone.com. Read about maps, iterators and basically STL. it’s really a powerful tool for many operations with less code to type with efficieny as an add-on. See : http://www.cplusplus.com/reference/utility/pair/
http://www.cplusplus.com/reference/map/map/
http://www.cplusplus.com/reference/utility/make_pair/