Posted: Tue Oct 17, 2006 7:57 pm Post subject: finding max value
Hi in a part of my program i have a loop that does some basic math to calculate a number, now the loops stops when the number reachers zero, but the number starts increasing first then after it reaches a max number it will then start decreasing, its a basic math multiplication. I was wondering how i could get that maximum value and store it in a variable, what check do i need to use?
Sponsor Sponsor
[Gandalf]
Posted: Tue Oct 17, 2006 9:40 pm Post subject: (No subject)
code:
if (currentNumber > currentMaxNumber) currentMaxNumber = currentNumber;
or if you include <cmath>.
code:
currentMaxNumber = max (currentNumber, currentMaxNumber);
Something along those lines. If you need more specific help, just be more specific in your next question.
wtd
Posted: Wed Oct 18, 2006 12:28 am Post subject: (No subject)