Friday, October 18, 2019

178. Qbasic sequential file handling that asks a user to input a registration number and displays the record of the particular registration if present.

178.A sequential data file 'Student.dat' contains registration number, student name, address and date of birth of some students. Write a program that asks a user to input a registration number and displays the record of the particular registration if present.
OPEN “STUDENT.DAT” FOR INPUT AS #1
CLS
INPUT “Enter registration no. to be searched”; S
FLAG=0
WHILE NOT EOF(1)
INPUT #1, R, N$, A$, D$
IF S = R THEN
PRINT R, N$, A$, D$
FLAG=1
END IF
WEND
IF FLAG=0 THEN PRINT “Data not found”
CLOSE #1
END

No comments:

Post a Comment