Posted: Thu Nov 23, 2006 8:54 pm Post subject: How easy is this program?
I'm trying to make one that has the user enter a series of numbers and the program will find the largest number once the user exits. It's kind of hard though. Someone help.
Sponsor Sponsor
ericfourfour
Posted: Thu Nov 23, 2006 9:02 pm Post subject: (No subject)
Well you get a number see if it is greater than the largest. If it is it becomes the largest. Repeat.
J2S
Posted: Thu Nov 23, 2006 9:05 pm Post subject: (No subject)
code:
loop
exit when num = -999
get num
n := n + 1
if n > num then
end loop
J2S
Posted: Thu Nov 23, 2006 9:06 pm Post subject: (No subject)
I still don't understand it. Harhar
ericfourfour
Posted: Thu Nov 23, 2006 10:14 pm Post subject: (No subject)
This is not a hard problem. If you want to keep track of the largest number what do you do? If you want to check if a number is greater than the largest number what do you do?
Clayton
Posted: Thu Nov 23, 2006 10:20 pm Post subject: (No subject)
pseudo:
loop
get a number
exit if number = -1000000 (or whatever you want)
if the number is bigger than the previous number, it is now the largest number
end loop
output the largest number