Hi to all, I am new to this C++ world
I have kind of a quick question. I need to do a modified selection sort that can handle characters. I know how to do one but only with integers (see code below). Any help or suggestion as to how I should go about it is greatly appriciated. : )
//function selection_sort...
void selection_sort (int array[], int elements)
{
int start_scan, my_index, my_value;
for (start_scan = 0; start_scan < (elements - 1); start_scan++)
{
my_index = start_scan;
my_value = array[start_scan];
for (int index = start_scan + 1; index < elements; index++)
{
if (array[index] < my_value)
{
my_value = array[index];
my_index = index;
}
}
array[my_index] = array[start_scan]; //swap the elements
array[start_scan] = my_value;
}
}