- (IBAction)cal {
NSString *number1 = self.num1.text;
NSString *number2 = self.num2.text;
NSString* operator = self.ope.text.;
int n1 = number1.intValue;
int n2 = [number2 intValue];
float result;
{
switch(operator){
case '+':
result = n1 + n2;
break;
case '-':
result = n1 - n2;
NSLog(@"result:%d*********",result);
break;
case '*':
result = n1 * n2;
break;
case '/':
result = n1 / n2;
break;
}//switch
} */
self.result.text = [NSString stringWithFormat:@"%d",result];
[self.view endEditing:YES];
} |
|