Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How easy is this program?
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
J2S




PostPosted: 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. Shocked
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: 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




PostPosted: 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




PostPosted: Thu Nov 23, 2006 9:06 pm   Post subject: (No subject)

I still don't understand it. Harhar Embarassed
ericfourfour




PostPosted: 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




PostPosted: 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
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: