NSMutableArray?? NSMutableDictionary?? help

Discussion in 'iOS Programming' started by moomy, Apr 28, 2010.

  1. moomy macrumors newbie

    Joined:
    Apr 28, 2010
    #1
    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
     
  2. ChOas macrumors regular

    Joined:
    Nov 24, 2006
    Location:
    The Netherlands
    #2
    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.
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    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.
     
  4. moomy thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #4
    Thanks you two,

    I'll look into these ideas. I really appreciate you taking the time to reply.
    :)
     

Share This Page