|
here is what i ended up with, i jthink it is almost correct, but for some reason it is giving me an error. so if anybody can figure out what is wrong i'll be very thankful.
#include <cstdlib>
#include <iostream>
using namespace std;
void alphaSort(int numStrings, char *strptr[])
{
bool finished;
do
{
finished = true;
for ( int i = 0; i < numStrings - 1; i++)
{
if ( strcmp(strptr[i], strptr[i+1]) > 0 )
{
finished = false;
char *temp = strptr[i];
strptr[i] = strptr[i+1];
strptr[i+1] = temp;
}
}
}
while (!finished);
}
int main(int argc, char *argv[])
{
alphaSort ( argc - 1, argv + 1);
for ( int i =1; i < argc; i++);
cout << argv[i] << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
|