Friday, October 18, 2019

168. Qbasic sequential file handling to display those record whose sex is male and salary more than 10,000 and also the program counts the total number of records in that file.

168.Write a program that reads the ”INFO.DAT” file that has several record such as name, address, gender, post, and salary .The program display those record whose sex is male and salary more than 10,000 and also the program counts the total number of records in that file.
OPEN "INFO.DAT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
  INPUT #1, N$, A$, G$, P$, S
C = C + 1   
IF UCASE$(G$)=”M” AND S >= 10000 THEN PRINT N$, A$, G$, P$, S
WEND
PRINT “TOTAL NUMBER OF RECORDS=”; C
CLOSE #1
END

No comments:

Post a Comment