#how to get the highest number in a text file

11 messages · Page 1 of 1 (latest)

frosty ferryBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

vast bronze
#

Sure

#

There's a million ways to solve every problem, play around and have fun

vast bronze
#

You can't std::max the whole vector @noble carbon

#

So think about using a loop to go over the vector

safe dome
#

I guess let's go step by step.
Do you know how to read an integer from a file?

#

Okay so there are two options at this point, you can either
A) store the ints from a file into a container (like vector) or
B) just loop over the values and keep track of the largest value seen

#

Which path do you choose to take?

#

So first things first, can you wrote some code to read all of the numbers and put them into a vector?

lethal pelican
#

You could use std::max_element() though.

frosty ferryBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.