Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan

Old Stuff => Chapter 2 - Programming in Objective-C => : rivozzz November 23, 2010, 01:44:58 AM



: Mind reading program
: rivozzz November 23, 2010, 01:44:58 AM
here a funny example that came to my mind

#import <Foundation/Foundation.h>


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

    NSLog(@"\n Lets play a game..\n I will figure a number you are thinking of...\n First choose a number\n Square it \n Add the result to your original number \n Divide by your original number. \n Add a number, how about 17. \n Subtract your original number. \n Divide by 6 \n The number you are thinking of now is 3!");
   

    [pool drain];
    return 0;
}


output
2010-11-23 10:46:49.459 Mind Reading program[4469:a0f]
 Lets play a game..
 I will figure a number you are thinking of...
 First choose a number
 Square it
 Add the result to your original number
 Divide by your original number.
 Add a number, how about 17.
 Subtract your original number.
 Divide by 6
 The number you are thinking of now is 3!


: Re: Mind reading program
: skochan December 17, 2010, 09:34:54 PM
Hey, that's a great start.   I recall that math trick!

Cheers,

Steve


Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.