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

Username:   Password: 
 RegisterRegister   
 Arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shruti




PostPosted: Wed Apr 16, 2008 2:58 pm   Post subject: Arrays

i have to write a program in which i have to find the oldest & the youngest person in class but i dont know how to do that, i have tried many programs but they dont work plzzzzzzzzzzzz help me out Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Wed Apr 16, 2008 3:07 pm   Post subject: RE:Arrays

You are trying to sort them based on age. Look up Bubble Sort, it has been mentioned numerous times through the forums.
OneOffDriveByPoster




PostPosted: Wed Apr 16, 2008 3:19 pm   Post subject: Re: Arrays

Since you only need to know the oldest and the youngest, you can avoid arrays and sorting by keeping a "running" min and max. Hint: Initialize min to a high number and max to a low number. Update as you get the ages.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: