Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question at random
#1
I'm creating a Quiz Program. Can some suggest a way to generate questions at random. And then store them somewhere so they aren't asked again. Pleease help! :???:
Reply
#2
well, here's a cheap way, but hey Smile

Code:
dim questions(0 to 4) as string '5 spaces
dim answers (0 to 4) as string

for i = 0 to 4
  read questions(i)
  read answers(i)
next i

for i = 0 to 4
  x1 = int (rnd * 5)
  x2 = int (rnd * 5)
  swap questions(x1), questions(x2)
  swap answers(x1), answers(x2)
next i

for i = 0 to 4
  input questions(i), myanswer$
  if myanswer$ = answers(i) then print "right" else print "wrongo"
next i

data"What's one plus one?"
data "Two
data "What's two plus two?"
data "Four"
data "What's three plus three?"
data "Six"
data "What's four plus four?"
data "Eight"
data "What's the capital of gadjookistan?"
data "Hell if I know"
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)