Developing for iPhone

Learn how to create and develop iPhone applications from scratch.

Tagged with ‘math’

Tutorial 1-4: More Variables

Posted by Henry On April - 14 - 2009 1 COMMENT

In this tutorial, I will be showing you a couple more ways to use variables.

Open your “Hello World” project from the previous tutorials, and open the “Hello World.m” file to start editing. Edit the program so it looks like this:

#import <foundation /Foundation.h>
 
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
	int age;
	int fingers;
 
	age = 99;
	fingers = 10;
 
	NSLog(@"I am %i years old and I have %i fingers!", age, fingers);
 
    [pool drain];
    return 0;
}</foundation>

Read the rest of this entry »