Sorry about only including the insertion sort function and I certainly don't want anyone to write out a program for me. I was just looking for a little direction, a little leading.
Here is the whole code that I have so far.
//using namespace std;
const int rows = 3;
const int cols = 10...
I am trying to do an insertion sort program where I sort a 2-D array. I think I am close, but I keep getting so screwy data after array[1][0]. Everything in row one sorts out great and the first element in row 2 is set right, but then it just goes wild.
Here's the source code that I have...
obislavu
Unfortunately I have no idea what vectors or pointers are yet. Actually I think vectors are what is up next in my class.
kmfna
I sort of followed the second part. I'll study it some more and see if I can't come up with something.
Thanks for the responses.
array[1][col] {0, 1, 2, 3, 7, 10, 12, 14, 15, 16}
array[2][col] {18, 19, 20, 23, 25, 29, 34, 35, 39, 40}
array[3][col] {42, 45, 65, 74, 99, 100, 109, 122, 156, 176}
Is this what you're looking for??
Yes, that is what I want to do. I'll look at the other part now
int array[rows][cols]={
{15, 40, 25, 100, 16, 1, 10, 42, 35, 23},
{122, 14, 3, 19, 156, 45, 2, 99, 74, 65},
{0, 34, 39, 109, 176, 20, 7, 18, 29, 12}
};
This is what I want sorted. I want to use the selection sort method. I know there...
Ok, the program below sorts the individual rows. I need it to sort all the numbers in each position, not just the rows. Any help would be appreciated.
#include <iostream>
using namespace std;
const int rows = 3;
const int cols = 10;
void select_sort( );
int array[rows][cols]={...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.