Created
March 4, 2013 19:46
-
-
Save anonymous/5084934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Bytelandian.h | |
// 121 bytelandian | |
// | |
#import <Foundation/Foundation.h> | |
@interface Bytelandian : NSObject | |
{ | |
int value; | |
} | |
@property int value; | |
- (id) initWithValue: (int) v; | |
- (int) CalcChange: (int) n; | |
@end | |
// | |
// Bytelandian.m | |
// 121 bytelandian | |
// | |
#import "Bytelandian.h" | |
@implementation Bytelandian | |
@synthesize value; | |
- (id) initWithValue: (int) v | |
{ | |
self = [super init]; | |
if (self) | |
{ | |
[self setValue: v]; | |
} | |
return self; | |
} | |
- (int) CalcChange: (int) n | |
{ | |
if (n == 0) | |
return 1; | |
else | |
return ([self CalcChange: (n / 2)] + | |
[self CalcChange: (n / 3)] + | |
[self CalcChange: (n / 4)]); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment