PDA

View Full Version : I have problem in Three digit numbers in Iphone using Cocoa




vavdiyaharesh
May 29, 2008, 05:49 AM
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:@"%d", numResult];
txtResult.text=str;
}



So can anyone tell me solution of my problem.

Thankx in advance.