anonymous / gist:5084934
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:5084934
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//
// 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
Something went wrong with that request. Please try again.