Re: How do I get this program to ask more than one question?
- Posted by znorq2 Jan 06, 2009
- 2564 views
How about this;
atom the_question constant questionid = 1, answerid = 2, correctid = 3 constant questions = { { "QUESTION 1", {"Q1 ANSWER1", "Q1 ANSWER2", "Q1 ANSWER3", ...}, CORRECT_ANSWER_INDEX }, { "QUESTION 2", {"Q2 ANSWER1", "Q2 ANSWER2", "Q2 ANSWER3", "Q2 ANSWER4", ...}, CORRECT_ANSWER_INDEX }, .... }
In my opinion, this is much more flexible, but might be abit confusing.. Anyway, here you can have any amount of questions and answers you'd like.
Code for retriving the question and the correct answer would be (question 1);
the_question = 1 questions[the_question][questionid] = the question questions[the_question][answerid][1..$] = possible answers questions[the_question][answerid][questions[the_question][correctid]] = Correct answer
the_question is an atom refering to the question you're asking.
Kenneth / ZNorQ