sorting an array

I have to develop and implement a program that sorts an array using the index sort algorithm, although i was also told I could use bubble sort. I also can't change the main function shown below, as well as having to define initializeArray & indexSort using void initializeArray(int numbers[]); & void indexSort (int numbers[], int indexes[]); respectively. my problem is how to even get started any help would be great

this is what i have so far
#include <iostream>

using namespace std;

int main()
{
// Declare variables
int numbers[10], indexes[10];
// Randomly initialize the array numbers
initializeArray(numbers);
// Initialize the array indexes
for (int i = 0; i<10; i++)
indexes[i] = i;
// Display the arrays before the sorting
cout << "numbers:";
for (int i = 0; i<10; i++)
cout << numbers[i] << " ";
cout << "\nindexes:";
for (int i = 0; i<10; i++)
cout << indexes[i] << " ";
// Sort the array
indexSort(numbers, indexes);
// Display the arrays after the sorting
cout << "\n*****************************\n";
cout << "numbers:";
for (int i = 0; i<10; i++)
cout << numbers[i] << " ";
cout << "\nindexes:";
for (int i = 0; i<10; i++)
cout << indexes[i] << " ";
return 0;
}
Last edited on
Topic archived. No new replies allowed.