I wanted, to do program which sorts 2D array by the first dimension so that means, that it gets sorted by the first dimension and the second dimension goes where the first has gone.
for example I want array a[4][2]=[["3", "4"], ["1", "7"], ["6", "8"], ["5", "1"]] becomes [["1", "7"] ["3", "4"] ["5", "1"] ["6", "8"]], so with the program:
int a[10][2];
for (int i=0;i<10;i++){
a[i][0]=10-i;
a[i][1]=i;
}
sort(a[0],a[10]);
for(int i=0;i<10;i++)
cout<<a[i][0]<<" "<<a[i][1]<<" ";
}
I want cout "1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 9 1 10 0" but cout is "0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10". How can I do it?