Created
May 25, 2009 08:18
-
-
Save akio0911/117441 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main() { | |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |
NSArray *keys = [NSArray arrayWithObjects:@"red", @"green", @"blue", nil]; | |
NSArray *values = [NSArray arrayWithObjects:[NSNumber numberWithInt:1], | |
[NSNumber numberWithInt:2], | |
[NSNumber numberWithInt:3], nil]; | |
NSMutableDictionary *dictionary = | |
[NSMutableDictionary dictionaryWithObjects:values forKeys:keys]; | |
NSLog(@"%@", dictionary); | |
for(NSString *key in keys){ | |
int count = [[dictionary objectForKey:key] intValue]; | |
[dictionary setObject:[NSNumber numberWithInt:count+10] | |
forKey:key]; | |
} | |
NSLog(@"%@", dictionary); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment