Link to home
Start Free TrialLog in
Avatar of mamoru120997
mamoru120997

asked on

How to sort names alphabetically in C

Hello, I'm a freshman programming student and I need a VERY FAST solution to a finals project our professor gave us. We need to write the code for a C program that:
1)Will ask the user to input names or words (perhaps 10 names)
2)Will show a menu asking the user if he/she wants the names to be arranged in ascending or descending alphabetical order
3)Will output the names in the order specified by the user in one column
I know this sounds dumb to experts like you people, but please help me.
I'm pulling my hair out just thinking about the solution.
THANKS VERY MUCH IN ADVANCE!!!!!
Avatar of galkin
galkin

You ca use the fact that each letter is ASCII character, which is in turn no more that interger value. For instance a is 32, if I am not mistaken, b - 33 etc. So you can get first character in the word substruct 32 and sort numbers.  
I have the code for you ,if you want ,by the way 32 is the ascii code for (space)
Avatar of mamoru120997

ASKER

Not very useful.
ASKER CERTIFIED SOLUTION
Avatar of hbadr
hbadr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SO why do you ask if don't need the answer ,these things take time if you may know.