Main Code
//
// Viewcontroller. m
// Cal-0710
//
// Created by Apple on 14-7-10.
// Copyright (c) 2014 Camp David education. 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 (){
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 (){
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 (){
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 {
[Email protected] "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 (){
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