Friday, October 18, 2019

170. Qbasic sequential file handling to display all those records whose date of birth is in current month


170.Write a program to open a data file “record.dat” that contains name, address, date of birth, email and telephone number of some employees. Now display all those records whose date of birth is in current month.

OPEN "birth.dat" FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
    INPUT #1, n$, d$, a$
    b$ = LEFT$(DATE$, 2)
    c = VAL(b$)
    e$ = LEFT$(d$, 2)
    f = VAL(e$)
    IF c = f THEN PRINT n$, d$, a$
WEND
CLOSE #1
END

No comments:

Post a Comment