PDA

View Full Version : Sorting?



beckham
August 20th, 2007, 07:51 AM
I know how to sort a few number but i dont know to sort alphabet. Can anybody help me?

finer recliner
August 20th, 2007, 07:53 AM
what language? different languages will handle single characters differently. some will be very easy for comparing against one another (perl for example, in which a string is scalar).

fct
August 20th, 2007, 11:33 AM
In which language?

Languages like C implement strings as arrays of char, that is itself a numeric type. For example, comparisons like 'A'<'B' or 'A' == 'A' work. You just need to make those operations for every char in the string.

beckham
September 7th, 2007, 03:53 PM
Its in c language. I have found made the loop myself.Thanks for the efforts

gnusci
September 7th, 2007, 04:24 PM
Here you have the reference of a bunch of function you can use for string operation:

http://www.cplusplus.com/reference/clibrary/cstring/

In particular I think you may find strcmp very useful:

http://www.cplusplus.com/reference/clibrary/cstring/strcmp.html