Computer Science Canada Sorting a string |
Author: | cat8864 [ Thu Nov 20, 2008 1:58 pm ] | ||||
Post subject: | Sorting a string | ||||
I need to create a program that takes a string of user input and sorts according to vowel, consonant, number and other. I managed to get it to work partially. The vowels and consonants get sorted fine but anything else gets place with the consonants. Any attempt to modify it just results in one of many error messages that say the results are too long or something exceeds the boundaries. Here's my program so far:
Mod Edit: Instead of color tags for code, use syntax tags. Thanks
|
Author: | The_Bean [ Thu Nov 20, 2008 7:00 pm ] |
Post subject: | Re: Sorting a string |
Simply changing the =0 to >0 should do it. |
Author: | cat8864 [ Fri Nov 21, 2008 1:01 pm ] |
Post subject: | Re: Sorting a string |
Thanks! But why '>' instead of '='? Is it because the length changes each time or something? |
Author: | HellblazerX [ Fri Nov 21, 2008 1:06 pm ] |
Post subject: | RE:Sorting a string |
Because index returns the position of the character. |
Author: | cat8864 [ Fri Nov 21, 2008 1:39 pm ] |
Post subject: | Re: Sorting a string |
So because I had "= 0" it didn't read the rest of the if statement |