Code: Select all
CLS
' menu
menu:
CLS
DO
COLOR 10, 0
LOCATE 5, 15
PRINT "DATABASE"
LOCATE 22, 30
PRINT "(2) ADD"
LOCATE 22, 5
PRINT "(1) SEARCH"
'my INKEY statment
kp$ = INKEY$
IF kp$ = "2" THEN GOTO addp
IF kp$ = "1" THEN GOTO searchp
'This is the end of the menu
LOOP
'This adds people to the database
addp:
CLS
COLOR 10, 0
INPUT "Age:", age$
INPUT "Name:", name$
INPUT "Personality:", per$
INPUT "Pasttime(s):", past$
INPUT "Comment:", com$
OPEN "database.txt" FOR APPEND AS #1
PRINT #1, "Age:"; age$, "Name:"; name$
PRINT #1, "Personality:"; per$
PRINT #1, "Pasttime(s):"; past$
PRINT #1, "Comment:"; com$
CLOSE #1
GOTO menu
'This searches for files
searchp:
CLS
OPEN "database.txt" FOR INPUT AS #1
INPUT #1, name$, age$, per$, past$, com$
INPUT "Search by persons name:", name$
IF name$ = name$ THEN
PRINT name$, age$, per$, past, com$
END IF
CLOSE #1
END