Array Stuff
-
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
-
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
Store your used questions to a HashTable, then when you want to ask a new question check whether it already exists there.
-
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
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;
-
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
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