can we do sorting in chars in c++
like
if acdb is input
and abcd as output
any one provide me prog for this ...........
or Sample code:
plz...........

How are the char stored---individual free standing variables, string (C style vs STL string object vs other string object implementation like CString or APSTring), or individual char in an array/list/vector/stack, whatever?

Characters can be easily sorted the way numbers are, since they are numbers.

can any one provide me a sample code for it ........?????
plz

can any one provide me a sample code for it ........?????
plz

Sample code for what? A sorting algorithm? Sorting characters as opposed to integers (as Mosaic mentions, characters are treated as integers, only they don't have as big of a range). Lots of sample code out there. Check the code snippets section, google "C++ bubble sort", stuff like that, but be more specific if you've tried these things and haven't found the results. A bubble sort implementation is pretty short.

If you know how to sort numbers, then just change the ranges to the appropriate characters ASCII values(or some other standard).

http://www.asciitable.com/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.