- (void)viewDidLoad
{
[super viewDidLoad];
resultText.text=@"0.0";
// Do any additional setup after loading the view, typically from a nib.
}
-(IBAction)digitPress:(id)sender{
currentNo=currentNo*10+[sender tag];
resultText.text=[NSString stringWithFormat:@"%d",currentNo];
}(IBAction)OperatorPress:(id)sender{
if(currentOpertaion==0){
result=currentNo;
}else{
switch (currentOpertaion) {
case 1:
result=result+currentNo;
break;
case 2:
result=result-currentNo;
break;
default:
break;
}
}
currentNo=0;
resultText.text=[NSString stringWithFormat:@"%d",result];
if([sender tag]==0)result=0;
currentOpertaion=[sender tag];
}
-(IBAction)clear:(id)sender{
resultText.text=@"0.0";
currentNo=0;
result=0;
}
{
[super viewDidLoad];
resultText.text=@"0.0";
// Do any additional setup after loading the view, typically from a nib.
}
-(IBAction)digitPress:(id)sender{
currentNo=currentNo*10+[sender tag];
resultText.text=[NSString stringWithFormat:@"%d",currentNo];
}(IBAction)OperatorPress:(id)sender{
if(currentOpertaion==0){
result=currentNo;
}else{
switch (currentOpertaion) {
case 1:
result=result+currentNo;
break;
case 2:
result=result-currentNo;
break;
default:
break;
}
}
currentNo=0;
resultText.text=[NSString stringWithFormat:@"%d",result];
if([sender tag]==0)result=0;
currentOpertaion=[sender tag];
}
-(IBAction)clear:(id)sender{
resultText.text=@"0.0";
currentNo=0;
result=0;
}
No comments:
Post a Comment