Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with Alphabetizing strings

jloginjlogin Member Posts: 1
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]) {
t=c[i];
c[i]=c[j];
c[j]=t;


}
}

}

puts("This is your string alphabetize:");
puts(c);

Comments

Sign In or Register to comment.