Search:
Forum
General C++ Programming
Find the top 3 numbers in a list
Find the top 3 numbers in a list
Oct 27, 2012 at 1:39pm UTC
lSgtPepperl
(11)
I made a list of numbers that the user inputs, and then the program has to find what 3 are the largest, but im not sure how to find the top 3
Oct 27, 2012 at 1:46pm UTC
Moschops
(7244)
How would you do it on paper if I gave you a list of numbers? Do it like that.
Oct 27, 2012 at 2:30pm UTC
vlad from moscow
(6539)
It is unsolvable task if the list contains less than three elements!:)
Oct 27, 2012 at 4:23pm UTC
IceThatJaw
(529)
Sort the list and then take the last 3 numbers or figure out what math algorithm can be used to find them in the quickest amount of time.
Oct 27, 2012 at 4:26pm UTC
jumper007
(435)
The easiest way is sure the STL
sort()
function, but I guess you have to work with a simple array of integers and not the algorithm and vector libraries.
Let us know if you got any issues (after you actually try to write that program).
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs