Amazon.com Widgets Program 15.6
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2013, 01:15:39 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Program Examples
| | |-+  Chapter 15
| | | |-+  Program 15.6
Pages: [1]   Go Down
Print
Author Topic: Program 15.6  (Read 1085 times)
TotalLuck
Full Member
***
Posts: 107



WWW Email




« on: February 15, 2009, 02:13:28 PM »

Code: (Objective-C)
#import <Foundation/NSObject.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSAutoreleasePool.h>


int main(int argc, char *argv[])
{
        int       i;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc ] init];
   

// create an array to contain the month names

NSArray * monthNames = [NSArray arrayWithObjects:
@"January", @"February", @"March", @"April",
@"May", @"June", @"July", @"August", @"September",
@"October", @"November", @"December", nil];


// Now list all the elements in the array

NSLog (@"Month Name");
NSLog (@"===== ====");


for (i = 0; i < 12; ++i)
NSLog(@" %2i %@", i + 1, [monthNames objectAtIndex: i] );

[pool drain];

return 0;
}

[/pre]

output
Code: (Objective-C)
2009-02-15 13:09:42.594 Chapter15[38051:10b] Month	 Name
2009-02-15 13:09:42.595 Chapter15[38051:10b] ===== ====
2009-02-15 13:09:42.596 Chapter15[38051:10b]   1         January
2009-02-15 13:09:42.596 Chapter15[38051:10b]   2         February
2009-02-15 13:09:42.597 Chapter15[38051:10b]   3         March
2009-02-15 13:09:42.597 Chapter15[38051:10b]   4         April
2009-02-15 13:09:42.598 Chapter15[38051:10b]   5         May
2009-02-15 13:09:42.599 Chapter15[38051:10b]   6         June
2009-02-15 13:09:42.599 Chapter15[38051:10b]   7         July
2009-02-15 13:09:42.600 Chapter15[38051:10b]   8         August
2009-02-15 13:09:42.600 Chapter15[38051:10b]   9         September
2009-02-15 13:09:42.601 Chapter15[38051:10b]  10         October
2009-02-15 13:09:42.602 Chapter15[38051:10b]  11         November
2009-02-15 13:09:42.604 Chapter15[38051:10b]  12         December

[/pre]
Logged

Apps available on  iTunes store:
"ADACode"  iPhone and iPad versions, "ADAGuidelines" iPhone & iPad versions,  "Rehabilitation Act of 1973" for iPhone
"APokerTimer" now for iPhone http://bit.ly/h1fAJp
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.