I have an array of (4) floating point numbers and need to sort the array in descending order. I'm quite new to c++, and was wondering what would be the best way to do this?
Thanks.
Use std::sort
with a non-default comparator:
float data[SIZE];
data[0] = ...;
...
std::sort(data, data + size, std::greater<float>());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With