Saturday, January 9, 2021

HOW TO CREATE A SIMPLE QUIZ GAME FROM QBASIC?



QBASIC is a simple high level programming language mainly used to for educational purpose for secondary level students. It is easy and gives simple concepts about the programming world. Here is a simple quiz game code made by me from QBASIC when I was a grade 9 student. The main concept of this game is that you are asked a quiz question with three options and you should choose one option and try to score more. Let's see the program code :-

CLS
INPUT " enter your name"; n$
PRINT n$
INPUT "are you ready for quiz (yes or no)"; f$
IF f$ = "no" THEN GOTO lbl:
PRINT n$
PRINT "type all letters in lcase"
PRINT "game just begins in :"
PRINT "3"
PRINT "2"
PRINT "1"
PRINT "0"
PRINT "let's begin"
PRINT "here is first and very easy question :"
PRINT
PRINT "which is the highest mountain peak of the world ?"
PRINT "options :"
PRINT "1) mt k2 2)mt everest  3)mt kanchangungha"
INPUT "input correct answer 1,2 or 3"; a
IF a = 2 THEN
    c = c + 1
    PRINT n$
    PRINT "congrulation you gave correct answer"
ELSE
    w = w + 1
    PRINT n$
    PRINT "you gave wrong answer"
END IF
PRINT
INPUT "are you ready for next question"; zzz$
PRINT "the question is"
PRINT
PRINT "which is longest river of the world"
PRINT "the options are :"
PRINT "1)amazon  2)sun koshi  3)nile"
INPUT "input correct answer 1,2 or 3"; b
IF b = 3 THEN
    c = c + 1
    PRINT n$
    PRINT "you gave correct answer"
ELSE
    w = w + 1
    PRINT n$
    PRINT "you gave wrong answer"
END IF
PRINT
PRINT
PRINT "total correct answer are "; c
PRINT "total wrong answer are"; w
IF c = 2 THEN
    PRINT "your intellegence % is  100 %"
END IF
IF c = 1 THEN
    PRINT "your intellegence % is 50 %"
END IF
IF c = 0 THEN
    PRINT "your intellegence % is 0 %"
END IF
PRINT "good buy"
PRINT "thanks for playing "
PRINT
PRINT "Keep visiting Edurat.blogspot.com to boost your knowledge"
PRINT
GOTO pqr:
lbl:
PRINT
PRINT
PRINT n$
PRINT "you are not ready to play"
PRINT "thank you"
pqr:
END

[ IF YOU HAVE ANY QUERY OR SUGGESTION THEN FEEL FREE TO COMMENT BELOW. KEEP VISITING Edurat.blogspot.com TO BOOST YOUR KNOWLEDGE. THANK YOU. ]
Disqus Comments