Friday, October 18, 2019

174. Qbasic sequential file handling to print odd position records of the data file

174.A data file named “EMP.DAT” contains some records with the fields Code, Name, Post and Salary. Write a program to print odd position records of the data file.
OPEN "EMP.DAT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
  INPUT #1, C, N$, P$, S
D = D + 1   
IF MOD 2 = 1 THEN PRINT C, N$, P$, S
WEND
CLOSE #1
END

No comments:

Post a Comment