HI
What i'm trying to do is to find the median of a string of letters.
But at first the letters must put in order alphabetically.
I have wrote a C++ Programm for this step but it doesent run correctly.
Have anyone an idea ?
Here the part of the Programm:
Code:
char* sortstring( char quelle[] )
{
char* ziel = new char[ strlen(quelle)+1];
char* hilfe = new char[ strlen(quelle)+1];
int a = strlen(quelle);
strcpy (hilfe,quelle);
strcpy (ziel,quelle);
for( int k=0 ; k<a ; k++)
{
for( int i=0 ; i<a ; i++)
{
if(quelle[k]<hilfe[i])
ziel[k]=quelle[k];
else
ziel[k]=hilfe[i];
}
}
ziel[k++] ='\0';
return ziel;
}