cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Sorting from highest to lowest
Sorting from highest to lowest
Apr 10, 2016 at 8:46am UTC
XxshaydeexX
(1)
Hello everyone, I'm fairly new to C++ or programming for that matter and I ran into a snag. My program generates 6 random numbers and I need to sort them from highest to lowest. Can anyone tell me a way to do that?
Apr 10, 2016 at 8:51am UTC
Moschops
(7244)
Put them in an array, then like this:
sort(array, array+5, std::greater<
int
>());
This requires you to include the algorithm and functional headers.
Topic archived. No new replies allowed.