Wednesday, February 17, 2021

QBASIC PROJECT : STUDENT INFORMATION SYSTEM - SEE COMPUTER SCIENCE 2077

 QBASIC PROJECT : STUDENT INFORMATION SYSTEM

SEE COMPUTER SCIENCE 2077



DECLARE SUB ADD()

DECLARE SUB DIS()

DECLARE SUB SER()

DECLARE SUB DEL()

DECLARE SUB UPD()

TOP:

CLS

LOCATE 3, 15:

PRINT STRING$(45, "*")

LOCATE 17, 15:

PRINT STRING$(45, "*")

FOR I = 3 TO 17

    LOCATE I, 13: PRINT "*"

    LOCATE I, 59: PRINT "*"

NEXT I

LOCATE 25, 50:

PRINT "DEVELOPED BY : DEEPAK SHRESTHA"

LOCATE 5, 30:

PRINT "**WELCOME**"

LOCATE 6, 25:

PRINT "STUDENT INFORMATION SYSTEM"

LOCATE 7, 30:

PRINT "MAIN MENU"

LOCATE 8, 30:

PRINT "----------"

LOCATE 9, 25:

PRINT "1. ADD RECORDS"

LOCATE 10, 25:

PRINT "2. DISPLAY RECORDS"

LOCATE 11, 25:

PRINT "3. SEARCH RECORDS"

LOCATE 12, 25:

PRINT "4. DELETE RECORDS"

LOCATE 13, 25:

PRINT "5. UPDATE RECORDS"

LOCATE 14, 25:

INPUT "ENTER YOUR CHOICE (1-5)"; C

SELECT CASE C

    CASE 1

        CALL ADD

    CASE 2

        CALL DIS

    CASE 3

        CALL SER

    CASE 4

        CALL DEL

    CASE 5

        CALL UPD

    CASE ELSE


        LOCATE 20, 25: PRINT "PLEASE ENTER CORRECT NUMBER"

END SELECT

LOCATE 22, 20:

INPUT "DO U WANT TO GO TO MAIN MENU (Y/N)"; ANS$

IF UCASE$(ANS$) = "Y" THEN GOTO TOP

END


SUB ADD ()

OPEN "STD.DAT" FOR APPEND AS #1

DO

    CLS

    INPUT "ENTER ROLL NUMBER"; R

    INPUT "ENTER NAME"; N$

    INPUT "ENTER ADDRESS"; A$

    INPUT "ENTER TELEPHONE NUMBER"; T#

    WRITE #1, R, N$, A$, T#

    INPUT "DO YOU WANT TO CONTINUE(Y/N)"; CH$

LOOP WHILE UCASE$(CH$) = "Y"

CLOSE #1


END SUB


SUB DIS ()

OPEN "STD.DAT" FOR INPUT AS #1

CLS

PRINT "ROLL NUMBER", "NAME", "ADDRESS", "TELEPHONE"

WHILE NOT EOF(1)

    INPUT #1, R, N$, A$, T#

    PRINT R, N$, A$, T#

WEND

CLOSE #1


END SUB


SUB SER ()

OPEN "STD.DAT" FOR INPUT AS #1

CLS

INPUT "ENTER ROLL NUMBER TO SEARCH DATA"; SR

FLAG = 0

PRINT "ROLL NUMBER", "NAME", "ADDRESS", "TELEPHONE"

WHILE NOT EOF(1)

    INPUT #1, R, N$, A$, T#

    IF SR = R THEN

        PRINT R, N$, A$, T#

        FLAG = 1

    END IF

WEND

IF FLAG = 0 THEN PRINT "RECORD NOT FOUND"

CLOSE #1


END SUB


SUB DEL ()

OPEN "STD.DAT" FOR INPUT AS #1

OPEN "TEMP.DAT" FOR OUTPUT AS #2

CLS

INPUT "ENTER ROLL NUMBER TO DELETE DATA"; DR

FLAG = 0

WHILE NOT EOF(1)

    INPUT #1, R, N$, A$, T#

    IF DR = R THEN

        FLAG = 1

    ELSE

        WRITE #2, R, N$, A$, T#


    END IF

WEND

CLOSE

KILL "STD.DAT"

NAME "TEMP.DAT" AS "STD.DAT"

IF FLAG = 0 THEN

    PRINT "DATA NOT FOUND"

ELSE

    PRINT "DATA DELETED SUCCESSFULLY"

END IF


END SUB


SUB UPD ()

OPEN "STD.DAT" FOR INPUT AS #1

OPEN "TEMP.DAT" FOR OUTPUT AS #2

CLS

INPUT "ENTER ROLL NUMBER TO UPDATE DATA"; UR

FLAG = 0

WHILE NOT EOF(1)

    INPUT #1, R, N$, A$, T#

    IF UR <> R THEN

        WRITE #2, R, N$, A$, T#

    ELSE

        INPUT "ENTER ROLL NUMBER"; ER

        INPUT "ENTER NAME"; EN$

        INPUT "ENTER ADDRESS"; EA$

        INPUT "ENTER TELEPHONE NUMBER"; ET#

        WRITE #2, ER, EN$, EA$, ET#

        FLAG = 1

    END IF

WEND

CLOSE

KILL "STD.DAT"

NAME "TEMP.DAT" AS "STD.DAT"

IF FLAG = 0 THEN

    PRINT "DATA NOT FOUND"

ELSE

    PRINT "DATA DELETED SUCCESSFULLY"

END IF


END SUB




No comments:

Post a Comment