looking into arrays and rearranging from highest to lowest, possible?

is there a simple way to look into an array with a bunch of stored numbers and rearrange itself from lowest to highest?

I think i can figure it out, but the way i would do it would take a ton of code. Just wondering if there was a simple way.

Thanks

C++ noob
Last edited on
i dont understand where or how the .dat file is created
It isn't, your program assumes it exists.
yea, once i wrote that i figured it out. Thanks for the reply. Couldn't find the delete option so posted another question.
You mean sort the array? Say you have an array a[n]:

std::sort(&a[0], &a[n]);

That's it. std::sort() is found in <algorithm>.
1
2
3
// Here is a slightly different syntax for doing the same thing.  You can specify whatever range you wish
// using this template algorithm.
std::sort(a, a + n);
Topic archived. No new replies allowed.