I need help...
Input : Hello My World
Output : eHllo My World
desired output : eHllo My dlorW
Somehow my loop does not continue to the next series of words and stops after the first one...
Code:
puts ("Enter a String: ");
gets (c,"");
for(i=0;c[i] !=' ';i++)
{
for(j=0;c[j]!=' ';j++)
{
if(toupper(c[i])<toupper(c[j]))
{
t=c[i];
c[i]=c[j];
c[j]=t;
}
}
}
puts("This is your string alphabetize:");
puts(c);
Input : Hello My World
Output : eHllo My World
desired output : eHllo My dlorW
Somehow my loop does not continue to the next series of words and stops after the first one...
Code:
puts ("Enter a String: ");
gets (c,"");
for(i=0;c[i] !=' ';i++)
{
for(j=0;c[j]!=' ';j++)
{
if(toupper(c[i])<toupper(c[j]))
{
t=c[i];
c[i]=c[j];
c[j]=t;
}
}
}
puts("This is your string alphabetize:");
puts(c);