Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Array Stuff

Array Stuff

Scheduled Pinned Locked Moved Visual Basic
questiondata-structures
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cedrickdeorange
    wrote on last edited by
    #1

    i am doing a world quiz. what is the capital city of...? once a question has been asked, how can i stop the question from being repeated until the quiz has been reset. :sigh:

    Regards Zeldacat

    A G T 3 Replies Last reply
    0
    • C Cedrickdeorange

      i am doing a world quiz. what is the capital city of...? once a question has been asked, how can i stop the question from being repeated until the quiz has been reset. :sigh:

      Regards Zeldacat

      A Offline
      A Offline
      andyharman
      wrote on last edited by
      #2

      Store your used questions to a HashTable, then when you want to ask a new question check whether it already exists there.

      1 Reply Last reply
      0
      • C Cedrickdeorange

        i am doing a world quiz. what is the capital city of...? once a question has been asked, how can i stop the question from being repeated until the quiz has been reset. :sigh:

        Regards Zeldacat

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        That depends on how you store the questions and how you pick the questions to ask. You can keep a list of unused questions, and remove it from the list once it's used. You can keep a flag in each question that determines if it has been used or not. You can store an identifier or reference of the used questions to compare against. You can prepare a list of questions in the order that they will be asked and just loop through the list.

        --- single minded; short sighted; long gone;

        1 Reply Last reply
        0
        • C Cedrickdeorange

          i am doing a world quiz. what is the capital city of...? once a question has been asked, how can i stop the question from being repeated until the quiz has been reset. :sigh:

          Regards Zeldacat

          T Offline
          T Offline
          The ANZAC
          wrote on last edited by
          #4

          I suggest adding them to a list and deleting them after they are used. You can add them as strings to a string collection. Dim Questions as system.collections.specialized.stringcollection Dim UsedQuestion as system.collections.specialized.stringcollection dim ranQuestion as new random Dim CurretnQuestion as string = questions.item(ranquestion.next(-1, questions.count +1 ) questions.remove(indexof(CurrentQuestion)) UsedQuestions.add(currentQuestion) In this way, you never risk repeating a question.

          Posted by The ANZAC

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups