Associate
- Joined
- 29 Jul 2005
- Posts
- 445
- Location
- Matlock
Hi there, I have started using QBASIC at school and we've been set the task to complete a quiz on captial citys. I have completed this task however I am a bit of a perfectionist and just wondered if there was a way of making the random number generator NOT generate a number that has been previously, thus not asking the same question twice
Here is what I have so far:
I'm really stumped now and have been trying to do this for ages!! Any help would be appreciatted
thanks
marc
Here is what I have so far:
Code:
REM Capital City
DIM country$(20), capital$(20)
RANDOMIZE TIMER
CLS
LET q = 1
LET score = 0
FOR x = 1 TO 13
READ country$(x), capital$(x)
NEXT x
INPUT "How many questions do you want"; qnum
FOR q = 1 TO qnum STEP 1
nub = INT(RND * 13) + 1
PRINT "What is the capital of "; country$(nub); "?"
INPUT answer$
IF answer$ = capital$(nub) THEN
LET score = score + 1
PRINT "Well done, that was the correct answer"
PRINT " "
ELSE
PRINT "Sorry, the capital of "; country$(nub); " is "; capital$(nub)
PRINT " "
END IF
NEXT q
total = score / qnum
COLOR 9
PRINT "Your score is "; score; "/"; qnum
END
DATA France, Paris, Albania, Tirona, Finland, Helsinki, Ireland, Dublin
DATA England, London, Austria, Vienna, Germany, Berlin, Luxembourg, Luxembourg
DATA Barbados, Bridgetown, USA, Washington DC, Russia, Moscow,
DATA Eygpt, Cairo, Greece, Athens,
I'm really stumped now and have been trying to do this for ages!! Any help would be appreciatted
thanks

marc