Tutorial 2-3: The if Statement
On April - 22 - 2009 1 COMMENT
Let’s start by opening the “Objects Intro” project from the last tutorial. If you haven’t done so already, I strongly recommend that you add some comments to the code you have written so far which explain what each part does.
Once you have done that, open “Objects Intro.m” and edit it to look like this:
#import <foundation /Foundation.h> #import "Television.h" int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int chanChange; Television *myTV = [[Television alloc] init]; NSLog(@"Type in the channel number:"); scanf("%i", &chanChange); [myTV changeChannel: chanChange]; [myTV watch]; [myTV release]; [pool drain]; return 0; } </foundation>