freshpost.net

by Cal on Dec.11, 2009, under Uncategorized

//

//  accumulator.h

//  calctest2

//

//  Created by Cal Folds on 12/7/09.

//  Copyright 2009 __MyCompanyName__. All rights reserved.

//

#import <Cocoa/Cocoa.h>

#import <Foundation/Foundation.h>

@interface accumulator : NSObject {

int accumValue;

int nextDigit;

}

-(void)resetAccumValue;

-(void)addNextDigitToAccumValue:(int)dig;

-(int)accumulatorValue;

@end


———————————–


//  accumulator.m

//  calctest2

//

//  Created by Cal Folds on 12/7/09.

//  Copyright 2009 __MyCompanyName__. All rights reserved.

//

#import “accumulator.h”

@implementation accumulator

-(void)resetAccumValue

{

accumValue = 0;

NSLog(@”accumValue is now %i\r”,accumValue);

}

-(void)addNextDigitToAccumValue:(int)dig

{

accumValue = accumValue * 10 + dig;

NSLog(@”accumulator thinks a user pressed %i\r”,dig);

NSLog(@”accumValue is now %i\r”,accumValue);

}

-(int)accumulatorValue;

{

return accumValue;

}

@end

———————————–


//  calctest2AppDelegate.h

//  calctest2

//

//  Created by Cal Folds on 12/7/09.

//  Copyright 2009 __MyCompanyName__. All rights reserved.

//

#import <Cocoa/Cocoa.h>

#import “accumulator.h”

@interface calctest2AppDelegate : NSObject <NSApplicationDelegate> {

NSWindow *window;

IBOutlet id textField;

}

@property (assign) IBOutlet NSWindow *window;

- (IBAction)p1:(id)sender;

@end

———————————–


//  calctest2AppDelegate.m

//  calctest2

//

//  Created by Cal Folds on 12/7/09.

//  Copyright 2009 __MyCompanyName__. All rights reserved.

//

#import “calctest2AppDelegate.h”

#import “accumulator.h”

@implementation calctest2AppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

}

- (IBAction)p1:(id)sender

{

// [textField setStringValue: @"1"];

NSLog(@”I think I just sent 1 to addNextDigitToAccumValue”);

//[myAccumulator addNextDigitToAccumValue:1];

}

@end




Leave a Comment more...

Hello world!

by Cal on Nov.16, 2009, under Uncategorized

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

1 Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...