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 problem
sorting problem
Sep 9, 2009 at 8:13pm UTC
gong
(10)
hi
you have to enter values in the command line and it should print in the screen the highest one.
I has trying to sort a vector and making a return of the last number.
The code has no error but doesn't work right
Last edited on
Sep 11, 2009 at 1:58pm UTC
Sep 9, 2009 at 8:20pm UTC
helios
(17574)
return valores[n];
Should be return valores.back();
Sorting to get the max element isn't very efficient.
http://www.cplusplus.com/reference/algorithm/max_element/
Topic archived. No new replies allowed.