< previous page page_686 next page >

Page 686
Get Class Roster (Out: student, length; Inout: roster)
Set length = 0
Read stuName from roster file
WHILE NOT EOF on roster
 Insert stuName into student list, incrementing length
 Read stuName from roster file

The decision to use a sentinel string to end the data requires a priming read in the Check In Students module-stuName must have a value on entering the loop. A prompt to the user should also be included.
Check in Students (In: student, length; Inout: isPresent)
Print "Enter last name"
Read stuName
WHILE stuName isn't "EndData"
  Process stuName
  Print "Enter last name"
  Read stuName

Insert Name (Inout: list, length; In: item) Level 2
(For Insert Name you can use functions Insert and
SearchOrd, which we wrote earlier.)

Process Name (In: student, length, stuName; Inout: isPresent)
Search student list for stuName (use BinSearch here)
IF found
    Set isPresent[index] = TRUE
ELSE
    Print "Name not on roster."

 
< previous page page_686 next page >