can anybody solve this?
create a function that can sort string. string function "string_sort(. . .)"
which sorts the characters in a string alphabetically (but putting all upper-case letters before all lower-case letters).
- 9 years agoFavorite Answer
if it's in C++ :
if it's type string, convert it to a char* type ( u can just strcpy(char*tpy , mainstring) )
then include algorythm and use the "sort" function , as every character has an ASCII code this function just treat it as any other array of numbers and sorts it.
lucky you Upper case by default have a smaller ASCII value than lower case :)
oh and if use of "algorythm" is restricted just use any sort algorythm you know for normal numbers
bubble sort, etc....
hope that helps
- jimmymae2000Lv 79 years ago
Return the ASCII code for each element,, then sort by that.
- Anonymous9 years ago
Yes I can