Friday, October 18, 2019

172. Qbasic sequential file handling to displays only its last 50 records.

172.Write a Qbasic program that read the "EMP.DAT" file with Name, Address, Post and Salary columns from E: drive that has 500 records of employees and displays only its last 50 records.
OPEN "E:\EMP.DAT" FOR INPUT AS #1
CLS
FOR i = 1 TO 500
    INPUT #1, n$, a$, p$, s
    IF i >= 450 AND i <= 500 THEN PRINT n$, a$, p$, s
NEXT i
CLOSE #1
END

No comments:

Post a Comment