Qbasicnews.com
April 01, 2020, 05:39:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 2 [3]
  Print  
Author Topic: QUIZ GAME WITH SCORE  (Read 7398 times)
tabnewflax
New Member

Posts: 22


« Reply #30 on: March 19, 2004, 11:25:19 AM »

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
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #31 on: March 19, 2004, 11:36:33 AM »

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"
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #32 on: March 19, 2004, 04:00:44 PM »

That's capital. Unless you actually want to quiz people on the capitols of capitals...
Logged

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.
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #33 on: March 22, 2004, 10:03:23 AM »

Quote from: "Agamemnus"
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! Smiley
Logged

I'd knock on wood, but my desk is particle board.
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!