Code?
#import<Foundation/Foundation.h>intMainintargcConst Char*argv[]) {@autoreleasepool {/** * Question 1th Please store the following data in a dictionary and output the dictionary content as a string output: "xxx, age xxx, professional xxx" (replace XXX with the corresponding data). */NSString*name =@"Wangchongyang"; Nsinteger Age= About; NSString*job =@"Daozhang";//nsdictionary *[email protected]{@ "name": Name,//@ ' age ': @ (age),//@ "Job": Job};Nsdictionary *dict=[nsdictionary Dictionarywithobjectsandkeys:name,@"name", @ (age),@" Age", Job,@"Job", nil]; NSLog (@"name:%@,age:%@,job:%@", dict[@"name"],dict[@" Age"],dict[@"Job"]); /** * 2nd The following data are sorted in ascending order and output*/Nsarray*array = @[@"Tim Cook",@"Jony Ive",@"Steve Jobs",@"Robert Brunne",@"Philip Schiller"]; Nsarray*arrsort=[Array sortedarrayusingselector: @selector (compare:)]; for(NSString *strinchArrsort) {NSLog (@"%@", str); } /** * 3rd, remove "Robert Brunne" from the divisor group and output*/Nsmutablearray*mutarr=[Nsmutablearray Arraywitharray:arrsort]; [Mutarr removeobject:@"Robert Brunne"]; for(NSString *str1inchMutarr) {NSLog (@"%@", STR1); } } return 0;}
Example Nsdictionary Programming Questions-Dictionary sorting application (IOS5 Class)