var age : flexible array 1 .. 1 of int
var fname, lname : flexible array 1 .. 1 of string
var choice : string (1)
var stream : int
proc addDATA
open : stream, "data7.t", seek, put
seek : stream, *
loop
put "Please enter the last name: "
get lname (upper (lname))
put "Please enter the first name: "
get fname (upper (fname))
put "Please enter the age: "
get age (upper (age))
put : stream, lname (upper (lname)), " ", fname (upper (fname)), " ", age (upper (age))
new lname, upper (lname) + 1
new fname, upper (fname) + 1
new age, upper (age) + 1
put "Would you like to keep adding people to the list?"
put "y/n"
loop
getch (choice)
if choice = "n" or choice = "N" then
put "Proceeding back to menu..."
delay (400)
exit
elsif choice = "y" or choice = "Y" then
exit
else
put "THAT IS NOT A CHOICE"
end if
end loop
if choice = "n" or choice = "N" then
exit
end if
end loop
close : stream
end addDATA
addDATA
|