Neema,SEE model question set 9(issued by CDC)

Q.12 Rewrite the given program after correcting the bugs.

REM to delete a record from a data file
OPEN "STD.DAT" FOR INPUT AS #1
OPEN "TEMP.DAT FOR OUTPUT AS #2
INPUT "ENTER ROLL NUMBER TO DELETE:-"; R
DO WHILE NOT EOF(1)
  INPUT #1, R, N$, C
 IF R <> RN THEN
   WRITE #2, N$, C
  END IF
LOOP
CLOSE #1,
KILL "STD.DAT"
NAME "TEMP.DAT" AS "SECRETE.DAT"
END

Debugged program:-


REM to delete a record from a data file
OPEN "STD.DAT" FOR INPUT AS #1
OPEN "TEMP.DAT" FOR OUTPUT AS #2
INPUT "ENTER ROLL NUMBER TO DELETE:-"; R
DO WHILE NOT EOF(1)
  INPUT #1, RN, N$, C
  IF R <> RN THEN    WRITE #2, N$, C
  END IF
LOOP
CLOSE #1, #2
KILL "STD.DAT"
NAME "TEMP.DAT" AS "SECRETE.DAT"
END



Previous
Next Post »

Watermark free kinemaster

DOWNLOAD