zoukankan      html  css  js  c++  java
  • (1+2+3-1-2)*1*2/1/2=?李冬强

    主要代码

    //

    //  ViewController.m

    //  Cal-0710

    //

    //  Created by apple on 14-7-10.

    //  Copyright (c) 2014年 戴维营教育. All rights reserved.

    //

    #import "ViewController.h"

    @interface ViewController ()

    @property (weak, nonatomic) IBOutlet UILabel *label;

    @end

    @implementation ViewController

    - (IBAction)but0:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10;

               self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but3:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+3;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+3;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but4:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+4;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+4;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but5:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+5;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+5;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but6:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+6;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+6;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but7:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+7;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+7;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but8:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+8;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+8;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)but9:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+9;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+9;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)chenFa:(id)sender {

        cale.op='*';

           //    self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        if (a) {

            

            

            cale.a1=[cale fun:a];

            cale.a2=0;

            a=cale.op;

        }

        else {

            a=cale.op;

            

            self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        }

    }

    - (IBAction)chuFa:(id)sender {

         cale.op='/';

    //           self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        if (a) {

            

            

            cale.a1=[cale fun:a];

            cale.a2=0;

            a=cale.op;

        }

        else {

            a=cale.op;

            

            self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        }

    }

    - (IBAction)jian:(id)sender {

         cale.op='-';

          //     self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        if (a) {

            

            

            cale.a1=[cale fun:a];

            cale.a2=0;

            a=cale.op;

        }

        else {

            

            a=cale.op;

            self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        }

    }

    - (IBAction)clear:(id)sender {

        self.label.text=@"0";

        cale.a1=0;

        cale.a2=0;

        cale.op=0;

        

    }

    - (IBAction)but1:(id)sender {

        if(cale.op!=0)

        {

            

            cale.a2=cale.a2*10+1;

            self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

            

                         

        }

        else

        {

            cale.a1=cale.a1*10+1;

               self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

            

        }

    }

    - (IBAction)but2:(id)sender {

        if(cale.op!=0)

        {

            cale.a2=cale.a2*10+2;

               self.label.text=[NSString stringWithFormat:@"%f",cale.a2];

        }

        else

        {

            cale.a1=cale.a1*10+2;

               self.label.text=[NSString stringWithFormat:@"%f",cale.a1];

        }

    }

    - (IBAction)jia:(id)sender {

        cale.op='+';

        if (a) {

            

            

            cale.a1=[cale fun:a];

            cale.a2=0;

            a=cale.op;

        }

        else {

        a=cale.op;

        

           self.label.text=[NSString stringWithFormat:@"%c",cale.op];

        }

    }

    - (IBAction)dengYu:(id)sender {

        float result=[cale fun:cale.op];

        self.label.text=[NSString stringWithFormat:@"%f",result];

    }

    - (void)viewDidLoad {

        [super viewDidLoad];

        // Do any additional setup after loading the view, typically from a nib.

        

        cale=[[Cale alloc]init];

        NSLog(@"xx%c",cale.op);

        

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

    @end

  • 相关阅读:
    opencv入门踩坑之路(一)
    编写vue的时候(html也一样),限制一个div内可显示的字数
    win10开机后内存占用非常高,但是资源管理器显示的进程占用得很少,可以考虑更新驱动
    java 随机数产生 常用类及方法
    你不会的是这个正则表达式吗?
    系统编程第三次上机
    Java第三次上机随笔
    系统编程第二次实验
    Java第二次上机随笔
    面向对象-Java MOOC翁恺老师第一次作业
  • 原文地址:https://www.cnblogs.com/lidongq/p/3836595.html
Copyright © 2011-2022 走看看