Computer Science Canada

Recursion alphabetical

Author:  customae7 [ Sun Apr 29, 2007 7:27 pm ]
Post subject:  Recursion alphabetical

Does anyone know how to make a program that you input names into and it will list them alphabetically using recursion. I have a program here that will generate numbers with recursion if this helps, and maybe you can modify it to do names in alphabetical order.

Author:  Andy [ Sun Apr 29, 2007 8:14 pm ]
Post subject:  RE:Recursion alphabetical

no we will not do your homework for you.

Author:  Cervantes [ Sun Apr 29, 2007 11:20 pm ]
Post subject:  RE:Recursion alphabetical

Err, Andy... =/

customae7, if you have code that can sort numbers, you can do virtually the same thing to sort alphabetically.

Just as
code:
5 < 7

is valid (and returns true),
code:
"bar" < "foo"

is also valid (and returns true, because "bar" is alphabetically less than "foo").

With that, do you still have a question? Smile

Author:  customae7 [ Mon Apr 30, 2007 7:59 am ]
Post subject:  Re: Recursion alphabetical

ya actually im making this for my own use andy and i have a code for names now i just need to sort it alphabetical. Here is my new program take a look.

Author:  Drakain Zeil [ Mon Apr 30, 2007 3:32 pm ]
Post subject:  RE:Recursion alphabetical

Not entirely sure what that code is meant to do, it just looks like you initialize ... something?

You can sort names with the <, > operators.

Like Cervantes said, the same way you can test 100 < 100 ? true:false, abc is a number of a differnt data type. abc < abz ? true : false


: