Friday, October 18, 2019

161. Qbasic sequential file handling to count and display the total number of records present in the file.

161.A data file “lib.txt” consists of book’s name, author’s name and price of books. Write a program to count and display the total number of records present in the file.
OPEN "LIB.TXT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
  INPUT #1, A$, B$, C
D = D + 1
WEND
PRINT “TOTAL NUMBER OF RECORDS=”; D
CLOSE #1
END

No comments:

Post a Comment