When I clicked on "Run" in Xcode to run the code and see if everything is right, I said "Build Succeeded", but in the code output the following appears:
2015-12-11 17: 35: 38,289 prog1 [36561: 1080062] The value of myfraction is: (lldb)
Should not this appear? :
2015-12-11 17: 35: 38,289 prog1 [36561: 1080062] The value of myfraction is: 1/3.
Follow the code.
#import <Foundation/Foundation.h>
@interface Fraction : NSObject
-(void) print;
-(void) setnumerator: (int) n;
-(void) setdenominatior: (int) d;
@end
@implementation Fraction
{
int numerator;
int denominatior;
}
-(void) print
{
NSLog(@"%i/%i", numerator, denominatior);
}
-(void) setnumerator:(int) n
{
numerator = n;
}
-(void) setdenominatior:(int) d
{
denominatior = d;
}
@end
int main(int argc, const char * argv[])
{
@autoreleasepool {
Fraction *myFraction;
myFraction = [Fraction alloc];
myFraction = [myFraction init];
[myFraction setnumerator: 1];
[myFraction setdenominatior: 3];
NSLog(@"The value of myfraction is:");
[myFraction print];
}
return 0;
}