Originally Posted by
da penguin
Look, you have that #include<string.h> right? So why don't you use c++ strings? It's like
string str;
str = "whatever"
and it's easier.
Now this
for(int b=0;b<=(strlen(a)-1);b++)
{
for(int c=0;c<=(strlen(a)-2);c++)
{
if(strcmp(a[c],a[c+1])<0) //I DON"T THINK THIS IS RIGHT
{
strcpy(temp,a[c]);
strcpy(a[c],a[c+1]);
strcpy(a[c],temp);
}
}
}
is a mess. You could just compare a[c] < a[c+1] cuz this are characters, not strings and they are already sorted in ASCII.
Could you please explain what the program is supposed to do?
okay, the program should sort the characters in a string in descending order.. for example.. if i cin yahoo, the program should cout yooha.. there..
Last edited by scias23; Jan 1st, 2009 at 9:04 am. Reason: for clarification