Sorting arrays

This is a discussion on Sorting arrays within the C++ Programming forums, part of the General Programming Boards category; Hello, I need help. How would I go about doing this:
Getting character string from user - store into an ...

Sorting arrays

Hello, I need help. How would I go about doing this:
Getting character string from user - store into an array..user then inputs order that the character string to be printed out to screen. Any ideas?
For example:
user puts in: e l l o H
user then puts in: 2 3 4 5 1
Outputs to screen: Hello

> i think it requires two arrays and a recursive sort dont know to go about it an example would be great<

This would be a crude answer I know. but you could;
Read the string into an array 'mytext[]', then read the users number input as a string, tokenise it with spaces or comma's.
2,3,1,5,4. use atoi, to turn them into ints.
Giving you
a=2
b=3
c=1
d=5
e=4
etc.
Then just print from your array with something like
cout << mytext[a] << mytext[b] etc

I imagine this would work, but I'm sure there's something far more dynamic that could be done (I'm just another newb, and I don't write good answers when I'm away from my compiler)