' PHONE.BAS
' This program uses a variable-length string array to record names and
'   telephone numbers.

OPTION BASE 1             ' set lower bound of array to 1

CLS

INPUT "How many names would you like to enter?  ", names%
PRINT

DIM contacts$(names%, 2)  ' declare array for names and phone numbers

FOR i% = 1 TO names%      ' read names into contacts$ array
    INPUT "Enter name:  ", contacts$(i%, 1)
    INPUT "Enter phone number:  ", contacts$(i%, 2)
    PRINT
NEXT i%

PRINT "You entered the following contact list:"
PRINT

FOR i% = 1 TO names%      ' print contents of array
    PRINT "Name:  "; contacts$(i%, 1), "Phone:  "; contacts$(i%, 2)
NEXT i%

