I would like to have user click on a button to generate a ten-question quiz in the form of "a +/- b = c" where the values for a and b are from +10 to -10 and are randomly assigned for the ten questions. Also, the questions should randomly switch between addition and subtraction. How do I populate the plist file correctly? How do I use arc4random
to create ten questions with random integers?
I thought it would be neat to have questions display in a one-column picker where user can scroll through the questions or just have text at a certain CGPoint
on screen.
Instead, I have created a plist with 84 different possible questions and I want to randomly choose 10 from plist to create the quiz each time a user clicks on button. I have this so far:
NSString *plistFile = [[NSBundle mainBundle] pathForResource:@"global" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsofFile:plistFile];
NSLog(@"%@",[dict objectForKey:@"1"]);
NSLog(@"%@",[dict objectForKey:@"2"]);
NSLog(@"%@",[dict objectForKey:@"3"]);
global is the name of plist, @"1"
, @"2"
, @"3"
etc are the names of the 84 diff Q's I put in plist. How do I randomly choose 10 of the 84 NSLogs?