Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUIZ GAME WITH SCORE
#31
I started a week ago with Qbasic so I don't know a shit, but I'am very greatful that you are so kind with help on thís fourm :wink:

I have not tested all the ideas but I will soon
Reply
#32
heh... don't worry... you hopefully learn eventually. Everyone here... *ahem* ok... lots of people here will be glad to help.




edit: heres my quiz game...... look at it...
Code:
CLS
RANDOMIZE TIMER
'######below defines the max ammount of questions
maxq = 6
TYPE type1
flag AS SINGLE
question AS STRING * 30
answer AS STRING * 30
END TYPE
'######dimensiont the array as the max ammount of questions
DIM array(1 TO maxq) AS type1
'######below sets up the array
FOR i = 1 TO maxq
READ array(i).question
READ array(i).answer
array(i).flag = 0
NEXT i
FOR i = 1 TO maxq
'######this DO LOOP is here so that when it checks for a random number
'######it doesn't act like it was asked. it goes anround until it finds an
'######unasked question
DO
'######below finds a random number and checks to see if the question
'######was asked and if not sets flag to one (aka asked)
rand = INT(RND * maxq) + 1
IF array(rand).flag = 0 THEN
array(rand).flag = 1
'######below prints the question
PRINT array(rand).question
'######below is where you input your answer
INPUT a$
'######below checks the answers and if you are wrong it says the correct answer
IF LCASE$(a$) = LCASE$(RTRIM$(LTRIM$(array(rand).answer))) THEN score = score + 1: PRINT "Correct" ELSE PRINT "Wrong, the correct answer is "; LCASE$(RTRIM$(LTRIM$(array(rand).answer)))
EXIT DO
END IF
LOOP
NEXT i
PRINT
'######below prints something depending on your score
SELECT CASE score
CASE maxq: PRINT "You got them all right! Here's a cookie!"
CASE IS > maxq / 2: PRINT "Good job! You got"; score; "out of"; maxq
CASE 0: PRINT "You didn't get any correct..."
CASE ELSE: PRINT "You can do better but good job! You got"; score; "out of"; maxq
END SELECT
'######below are the data that holds the questions and answers
DATA "Will you answer no?", "maybe"
DATA "Are you dead?", "no"
DATA "Are you hungry?", "no"
DATA "What is the square root of 36", "6"
DATA "Who are you?", "Dead"
DATA "Can I poke you?", "42"
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#33
That's capital. Unless you actually want to quiz people on the capitols of capitals...
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#34
Quote:That's capital. Unless you actually want to quiz people on the capitols of capitals...
:roll: :roll: :roll: :roll: :roll:
Typical Nitpicking 101, meet your new professor: Agamemnus! Smile
I'd knock on wood, but my desk is particle board.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)