Tags:
create new tag
view all tags

Hint 2: Quiz with arrays: Repeating wrong answers

  1. Create a boolean array (the size of the number of questions) and initialize all to false.
  2. When a question is answered correctly, set that element in the boolean array to true.
  3. To find a question that has not been answered correctly:
    1. generate a random integer in the range of questions
    2. while that question has been answered correctly
      1. generate another random integer in the same range
    3. return the random number that allowed the loop to exit
Topic revision: r1 - 2024-06-14 - CathyBareiss
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback