Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vavdiyaharesh

macrumors newbie
Original poster
May 15, 2008
24
0
I m doing one calculator application in Iphone using cocoa i have done successfully addition of two number.

but problem is whenever i m trying to add number with 3-digit number, my iphone get hang and its perfectly working with 2-digit number.

So can anyone tell me solution of my problem.

Thankx in advance.

I m doing one calculator application in Iphone using cocoa i have done successfully addition of two number.

but problem is whenever i m trying to add number with 3-digit number, my iphone get hang and its perfectly working with 2-digit number.

Code for this is like

-(IBAction)push_plus
{
stringRes = txtResult.text;
txtResult.text=@"";

}
-(IBAction)push_equal
{

string2=txtResult.text;
int number1 = [stringRes intValue];
int number2 = [string2 intValue];
int numResult = number1+number2;
NSString *str = [NSString stringWithFormat:mad:"%d", numResult];
txtResult.text=str;
}

So can anyone tell me solution of my problem.

Thankx in advance.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.