// Columbus.m Copyright (c) Kari Laitinen // http://www.naturalprogramming.com // 2013-07-11 Objective-C version of this file was created. // 2013-07-12 Last modification. #include #import #import "class_isodate_oc.h" int main( void ) { NSAutoreleasePool* autorelease_pool = [ [ NSAutoreleasePool alloc ] init ] ; ISODate* date_of_discovery_of_america = [ [ ISODate alloc ] init_with_string: @"1492-10-12" ] ; ISODate* date_of_first_moon_landing = [ [ ISODate alloc ] init_with_string: @"1969-07-20" ] ; NSString* text_to_print = [ NSString stringWithFormat: @"\n Christopher Columbus discovered America on %@" @"\n That was a %@", date_of_discovery_of_america, [ date_of_discovery_of_america get_day_of_week ] ] ; printf( "%s", [ text_to_print UTF8String ] ) ; text_to_print = [ NSString stringWithFormat: @"\n\n Apollo 11 landed on the moon on %@" @"\n That was a %@", date_of_first_moon_landing, [ date_of_first_moon_landing get_day_of_week ] ] ; printf( "%s", [ text_to_print UTF8String ] ) ; int years_between, months_between, days_between ; [ date_of_discovery_of_america get_distance_to: date_of_first_moon_landing years: &years_between months: &months_between days: &days_between ] ; printf( "\n\n America was discovered %d years, %d months, and " "%d days \n before the first moon landing.\n\n", years_between, months_between, days_between ) ; [ autorelease_pool drain ] ; }