So, basically, you want your sorted array to also contain a record of the original positions of the elements, as they were in the unsorted array?
I'd recommend using an array of std::pair<int, int>. One half of the pair stores the value, and the other stores the original position. You then sort the pairs by the value. Then, when you look at the pairs in value-sorted order, the second half of the pair gives you the original position.
I don't get what you mean but okay..... don't need to be a douche about it since i'm a beginner -.- ...... I'm asking how does it work and I don't quite understand how it work is my problem if you actually read and that is an example that I've tried using but it doesn't work....... It won't set the array together
You posted some code. Presumably, there is some kind of problem with that code? The thing is, we can't read your mind. You have to tell us what the problem is. Are you getting compilation errors? Are you getting run-time errors? Is there some behaviour that happens when you run the code that you're not expecting?
You're asking us to give up our time and effort, free of charge, to help you. It behoves you to do whatever you can to make our job easier, and that includes taking the effort to type in whatever information might be useful in helping us fix your code.
cool............. I don't know if you know the definition of a beginner cause i honestly don't know what to tell you ......... sorry for wasting your time and effort obviously im asking nicely and you could have easily responded nicely to what i'm suppose to do
You know, I'm taking the time and effort to try and help you here. Since your only response it to be rude and insulting, then.... yeah, I think I'll stop.
Good luck with insulting people, and then trying to get them to help you.
Edit:
i honestly don't know what to tell you
You could tell us what it is you're seeing in your code that makes you think there's a problem. Are you seeing compiler errors? Are you seeing run-time crashes? Are you seeing some behaviour that you believe to be incorrect?
im asking nicely
Calling somebody a "douche" is your idea of asking nicely?
LOL coming from somebody insulting me "Don't just dump poorly formatted code on us and expect us to do all the work". Did i say go type my code for me? nope..... thx for noticing how you were insulting me too :) o and on top of that i asked nicely until u started to insult me and have a huge attitude with me...... guess u really don't know how to read and no your not taking any time or effort to help me by insulting me thank you for wasting my time here
There was no insult there. I didn't call you anything unpleasant or nasty at all. I simply pulled you up on a less-than-helpful way you were looking for help.
But at this point, it looks as though you're far more interested in being argumentative and defensive, than you are in doing the things that might actually get you the help you're looking for. I'm not interested in that, so I'll leave you to have fun on your own.