Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

objective C question

$
0
0
Alright this will most likely aptly display my lack of programming prowess but I am trying to teach myself objective c and I am programming a simple fraction program. I keep getting this as the output! Can anybody tell me why or what I can do to fi it?

//
// main.m
// prog3.4
//
// Created by Atticus Foller on 3/23/13.
// Copyright (c) 2013 AtticusFoller. All rights reserved.
//

#import <Foundation/Foundation.h>

//----@interface section----

@interface Fraction: NSObject

-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(int) numerator;
-(int) denominator;

@end

//---@implementation section---

@implementation Fraction
{
int numerator;
int denominator;
}

-(void) print
{
NSLog (@"%i/%i", numerator, denominator);
}

-(void) setNumerator:(int)n
{
numerator = n;
}

-(void) setDenominator:(int)d
{
denominator =d;
}

-(int) numerator
{
return numerator;
}

-(int) denominator
{
return denominator;
}

@end

//----Program section----

int main (int argc, char *argv[])
{
@autoreleasepool {
Fraction *myFraction = [[Fraction alloc] init];

[myFraction setNumerator: 1];
[myFraction setDenominator: 3];

NSLog (@"The value of myFraction is: %i/%i", [myFraction numerator], [myFraction denominator]);

}
return 0;
}


output:(lldb)

What does this mean? No errors and this lldb thing. Is it a setting or an error?

Viewing all articles
Browse latest Browse all 2703

Trending Articles