#import <Foundation/Foundation.h>
@interface Math:NSObject
+( int ) max: ( int ) a B: ( int ) b;
@end
@implementation Math
+( int ) max: ( int ) a B: ( int ) b {
int result = a;
if( b > a )
result = b;
return result;
}
@end
int main(int argc, const char * argv[]) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
int a = 10, b = 120;
NSLog( @"Max value between ( %d, %d ) is: %d\n",
a, b, [ Math max: a B: b ] );
[pool drain];
return 0;
}
I2ltcG9ydCA8Rm91bmRhdGlvbi9Gb3VuZGF0aW9uLmg+CgpAaW50ZXJmYWNlIE1hdGg6TlNPYmplY3QKKyggaW50ICkgbWF4OiAoIGludCApIGEgQjogKCBpbnQgKSBiOwpAZW5kCgpAaW1wbGVtZW50YXRpb24gTWF0aAorKCBpbnQgKSBtYXg6ICggaW50ICkgYSBCOiAoIGludCApIGIgewogICAgaW50IHJlc3VsdCA9IGE7CiAgICBpZiggYiA+IGEgKQogICAgICAgIHJlc3VsdCA9IGI7CiAgICByZXR1cm4gcmVzdWx0Owp9CkBlbmQKCmludCBtYWluKGludCBhcmdjLCBjb25zdCBjaGFyICogYXJndltdKSB7CiAgICAKICAgIE5TQXV0b3JlbGVhc2VQb29sICpwb29sID0gW05TQXV0b3JlbGVhc2VQb29sIG5ld107CiAgICAgICAgaW50IGEgPSAxMCwgYiA9IDEyMDsKICAgICAgICBOU0xvZyggQCJNYXggdmFsdWUgYmV0d2VlbiAoICVkLCAlZCApIGlzOiAlZFxuIiwKICAgICAgICAgICAgICBhLCBiLCBbIE1hdGggbWF4OiBhIEI6IGIgXSApOwogICAgW3Bvb2wgZHJhaW5dOwogICAgCiAgICByZXR1cm4gMDsKfQ==