QBASIC Menu driven program
It is a menu-driven BASIC program to handle the following cases.
CLS
top:
CLS
PRINT "*-*-*-*-Main Menu-*-*-*-*"
PRINT " 1. Add Contact "
PRINT " 2. View Contact "
PRINT " 3. Quit"
INPUT "Enter Your Choice !! (1/2/3) : "; ch
SELECT CASE ch
CASE 1:
CALL addcontact
GOTO top
CASE 2
CALL viewcontact
GOTO top
CASE 3
SYSTEM
CASE ELSE
PRINT "Wrong Choice ! Try Again !!"
END SELECT
END
' SUB Module for adding contact
SUB addcontact
CLS
OPEN "contact.dat" FOR APPEND AS #1
DO
PRINT "*-*-*-Add Contact-*-*-*"
INPUT "Enter Name : "; n$
INPUT "Enter Address : "; a$
INPUT "Enter Phone : "; p#
WRITE #1, n$, a$, p#
INPUT "Do you want to add more records ? (Y/N) : "; ch$
LOOP WHILE UCASE$(ch$) = "Y"
CLOSE #1
END SUB
'SUB Module for display contact
SUB viewcontact
CLS
OPEN "contact.dat" FOR INPUT AS #2
PRINT "*-*-*-View Contact-*-*-*"
PRINT "Name", "Address", "Phone"
DO WHILE NOT EOF(2)
INPUT #2, n$, a$, p#
PRINT n$, a$, p#
LOOP
INPUT ""; k
CLOSE #2
END SUB
3747