' GOODNAME.BAS
' This program separates first and last names and prints them.

CLS

PRINT "Enter your first and last name in the following format:  ";
PRINT "Lastname, Firstname"
PRINT

LINE INPUT "Name:  ", fullName$

commaLocation% = INSTR(1, fullName$, ",")

IF (commaLocation% > 0) THEN
    lastName$ = LEFT$(fullName$, commaLocation% - 1)
    firstName$ = RIGHT$(fullName$, LEN(fullName$) - commaLocation% - 1)

    PRINT
    PRINT "What a lovely name!  It's so nice to meet you, ";
    PRINT firstName$; " "; lastName$; "!"
ELSE
    PRINT
    PRINT "Name not in Lastname, Firstname format."
END IF

