Friday, October 18, 2019

165. Qbasic sequential file handling to count total number of “Manager” in the data file. (hint: Manager is a post)

165.A data file name “EMP.DAT”, contains number of records having fields name, post and salary. Write a program to count total number of “Manager” in the data file. (hint: Manager is a post)
OPEN "EMP.DAT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
  INPUT #1, N$, P$, S
    IF UCASE$(P$) = “MANAGER” THEN PRINT C = C + 1
WEND
PRINT “TOTAL NO.OF MANAGERS ARE”; C
CLOSE #1
END

No comments:

Post a Comment