Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moomy

macrumors newbie
Original poster
Apr 28, 2010
28
0
Hi all,
I'm just learning iPhone programming. I'm starting to work with files and thought a good project to learn this would be a multiple choice style quiz.

I have managed to do a simple quiz with a text file linked to an array... however I want to randomize the questions and remove questions once they have been asked.

Do you think a NSMutableDictionary would do this.. can a key be linked to the question, the possible answers and a marker to the correct answer??
or would a MutableArray be better??

Any advice would be fantastic as I am struggling to find a lot on info on this on the web.

thanks
moom
 
Hi all,

moom

I would use an NSMutableArray filled with NSDictionaries which hold the questions and answers. You pick a random dictionary from the array, then you have your question and answers. After picking you remove it from the NSMutableArray.
 
I would use an NSMutableArray of objects that represent questions, modeled using a class that contains the question, the answers (probably an array here), and index of the correct answer.
 
Thanks you two,

I'll look into these ideas. I really appreciate you taking the time to reply.
:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.