
-----------------------------------
shruti
Wed Apr 16, 2008 2:58 pm

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  :D

-----------------------------------
Sean
Wed Apr 16, 2008 3:07 pm

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
Wed Apr 16, 2008 3:19 pm

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.
