Friday, October 18, 2019

181. Qbasic sequential file handling to increase the marks of computer by 10 of those student who secured less than 40

181.A sequential data file “marks.dat” contains information such as student’s name, marks obtained in math, science and computer. Write a program that increase the marks of computer by 10 of those student who secured less than 40
OPEN "D:\PATIENT.DAT" FOR INPUT AS #1
OPEN "d:\TEMP.DAT" FOR OUTPUT AS #2
CLS
FLAG = 0
WHILE NOT EOF(1)
    INPUT #1, N$, A, B, C
    IF C > 40 THEN
        WRITE #2, N$, A, B, C
    ELSE
        C = C + 10
        WRITE #2, N$, A, B, C
        FLAG = 1
    END IF
WEND
IF FLAG = 0 THEN
    PRINT "DATA NOT FOUND"
ELSE
    PRINT "DATA EDITED"
END IF

CLOSE

KILL "D:\PATIENT.DAT"
NAME "D:\TEMP.DAT" AS "D:\PATIENT.DAT"
END

No comments:

Post a Comment