i made a bubblesort function
void BubbleSort( const char *array[] , int size ) { int result; for ( int next = 0; next < size - 1 ; ++next ) { for ( int j = 0; j < size - 1 - next; ++j ) { result = strcmp (array[j], array[j+1]); if (result > 0) swap ( array[j] , array[j+1] ); } } }
and in the main i just did the cout...
This is a perfect Bubble Sort. Now all you have to work on is your formatting ;)
void BubbleSort( const char *array[] , int size )
{
int result;
for ( int next = 0; next < size - 1 ; ++next )
{
for ( int j = 0; j < size - 1 - next; ++j )
{
result = strcmp (array[j], array[j+1]);
if (result > 0)
swap ( array[j] , array[j+1] );
}
}
}