Computer Science Canada im totally lost |
Author: | chipmiester [ Thu Nov 10, 2005 7:41 pm ] |
Post subject: | im totally lost |
ok i have no clue as to how i would do this. how would i be able to sort names entered alphabetically? example: if i enter compsci it would put it on a list of a-h names only and if i enter zebra it will go on the second list of i-z. all i need to know would be how to sort them. i can program it to accept user input and the if...end if thing with elsif. (thats what were learning at the moment) so will anyone be able to help me sort inputted names with the if..end if command (with elsif) |
Author: | iker [ Thu Nov 10, 2005 8:04 pm ] | ||
Post subject: | |||
You should know not to help for school work on this site, but its a very simple program anyways...
this will get all of your words, then output them in the order that you gave them ![]() |
Author: | chipmiester [ Thu Nov 10, 2005 8:12 pm ] |
Post subject: | |
lol i know that does that but how do i sort by alphabet (one list A-H other one I-Z) we were not taught this yet |
Author: | Tony [ Thu Nov 10, 2005 10:38 pm ] | ||
Post subject: | |||
you can compare words to each other
that should result in true, which you could use in an if statement to determine that your word ("compsci" in this case) comes before letter "i" alphabetically. watch out for upper case, those letters have different values. You should make sure that both words are of the same case before comparing, so a function such as toupper() would be of use. |
Author: | [Gandalf] [ Thu Nov 10, 2005 10:43 pm ] |
Post subject: | |
No need to remake what you already have... Str.Upper() or Str.Lower() |
Author: | do_pete [ Fri Nov 11, 2005 11:20 am ] |
Post subject: | |
yeah bu some older versions of Turing don't have Str.Upper or Str.Lower |
Author: | xtreemboarder [ Wed Nov 16, 2005 1:56 am ] | ||
Post subject: | |||
iker wrote: You should know not to help for school work on this site, but its a very simple program anyways...
this will get all of your words, then output them in the order that you gave them ![]() program wouldnt work bud. cant assign an int to equal a string. ![]() |
Author: | iker [ Wed Nov 16, 2005 5:14 pm ] |
Post subject: | |
sorry, it should say string, but anyways, its a miner error from days ago..., and it wasn't even what he wanted... |