Not sure if I posted correctly. I am trying to do a bubble sort on a 2D array. I want to sort the array by columns. I get it to compile but it doesn't run correctly.
include <iostream>
using namespace std;
int main()
{
int array[10][10];
int col, row;
cout<<"Enter numbers to put into row ";
for(int i = 0; i < 9; i++){
cin>>row;
cout<<"Enter the numbers to put into column ";
for(int j = i+1; j < 10; j++){
cin>>col;
array[i][j];
}
}
int maxIndex;
for(int i=0; i<size-1;i++)
{
maxIndex=i;
for(int j=i+1;j<size;j++){
if(a[j][col] > a[maxIndex][col])
maxIndex=j;
}
if(a[i][col] > a[maxIndex][col]) {
int temp = a[i][col];
a[i][col] = a[maxIndex][col];
a[maxIndex][col] = temp;
}
}
}
for(int i = 0; i < 10; i++)
for(int j = i+1; j < 10; j++)
cout << array[i][j] << " ";
return 0;
}