-2

I can't seem to get this to work, I want this to display (The value of myXYPoint is,2,4) Here's my code. I keep getting this in my output area (lldb). This is from the exercise in the book programming in objective c by stephen g kochan, pg50 question 7. I tried comparing this with answers but still haven't found the problem. I also get this at line 14,(thread 1:breakpoint 1.1.2.1)

#import <Foundation/Foundation.h>

//interface section

@interface XYPoint: NSObject
-(void)setAbscissa: (int) x;
-(void)setOrdinate: (int) y;
-(int)abscissa;
-(int)ordinate;

@end

//--implementation section--

@implementation XYPoint
{
int abscissa;
int ordinate;
}
-(void)setAbscissa:(int)x
{
abscissa=x;
}

-(void)setOrdinate:(int)y
{
ordinate=y;
}
-(int) abscissa;
{
return abscissa;
}
-(int) ordinate;
{
return ordinate;
}

@end

//--program section--

int main(int argc, const char * argv[])
{

@autoreleasepool {
    XYPoint *myXYPoint = [[XYPoint alloc] init];
    //It could also be [XYPoint *myXYPoint = [XYPoint new]

    // Set coordinate to 2,4
    [myXYPoint setAbscissa: 2];
    [myXYPoint setOrdinate: 4];
    //setting the coordinates

    // Display the coordinate
    NSLog (@"The value of myXYPoint is: %i,%i", [myXYPoint abscissa], [myXYPoint ordinate]);
    //this is to display the coordinates


}
return 0;

}

Indrajeet
  • 5,490
  • 2
  • 28
  • 43
  • "I keep getting this in my output area." -- What is "this"?? And where is line 14?? – Hot Licks Aug 18 '14 at 12:02
  • I've just tried your code and I works on my end. What's the console output? https://www.dropbox.com/s/m5hyexptqi80m6c/Capture%20d%27%C3%A9cran%202014-08-18%2014.02.48.png – jbouaziz Aug 18 '14 at 12:02
  • i fixed this by clicking on the stop button on the top left and than running it and it worked,i just had to stop running the application first. thanks for helping so fast though. Stupid mistake, sorry – Louis Vidal Aug 18 '14 at 12:09

1 Answers1

0

i fixed this by clicking on the stop button on the top left in Xcode and than running it and it worked,i just had to stop running the application first. thanks for helping so fast though. Stupid mistake, sorry.