Computer Science Canada

Arrays

Author:  shruti [ 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

Author:  Sean [ 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.

Author:  OneOffDriveByPoster [ 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.


: