Sorting by alphabetic order

THIS WAS SOLVED

Thank you keskiverto (1867) for the help
Last edited on
The use of C++ standard library is definitely the way to go, unless the actual purpose is to learn to think logically rather than to make a necessary program.

For the latter:
1. Find first element that is larger than the new value.
2. Copy that and the rest one position to right.
3. Write the new value to its position.
4. Increase len.

The remove should mirror insert.
If I wanted to use the logic way rather than going into the C++ library, how would I find the element with a larger value? And then move the rest one position to the right?

Compromise a bit and make use of std::strings' relational operator <
if ( value < strArr[i] ) ...
You want to look words in the array, one at a time until you find one that fulfills the condition (or at end of array). You need the value of i.

Move is easy: strArr[x+1] = strArr[x]; However, which values of x are used and in what order?
Topic archived. No new replies allowed.