Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Help with Alphabetizing strings

$
0
0
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);

Viewing all articles
Browse latest Browse all 2703

Trending Articles