Advertisement
LSergey

ViewController.m

Mar 24th, 2017
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  ViewController.m
  3. //  Counter
  4. //
  5. //  Created by Сергей on 23.03.17.
  6. //  Copyright © 2017 School. All rights reserved.
  7. //
  8.  
  9. #import "ViewController.h"
  10.  
  11. @interface ViewController ()
  12.  
  13. @end
  14.  
  15. @implementation ViewController
  16.  
  17. - (void)viewDidLoad {
  18.     [super viewDidLoad];
  19.     // Do any additional setup after loading the view, typically from a nib.
  20. }
  21.  
  22.  
  23. - (void)didReceiveMemoryWarning {
  24.     [super didReceiveMemoryWarning];
  25.     // Dispose of any resources that can be recreated.
  26. }
  27.  
  28. -(IBAction)increment:(id)sender{
  29.     Ftotal++;
  30.     Ptotal++;
  31.     Count++;
  32.     [screen setText:[NSString stringWithFormat:@"%ld", Ftotal]];
  33.     [display setText:[NSString stringWithFormat:@"%ld", Ptotal]];
  34. }
  35.  
  36. -(IBAction)count:(id)sender{
  37.     Ftotal += Count;
  38.     Ptotal += Count;
  39.     //Count++;
  40.     [screen setText:[NSString stringWithFormat:@"%ld", Ftotal]];
  41.     [display setText:[NSString stringWithFormat:@"%ld", Ptotal]];
  42. }
  43.  
  44. -(IBAction)decrement:(id)sender{
  45.     Ptotal = 0;
  46.     Count = 0;
  47.     [screen setText:[NSString stringWithFormat:@"%ld", Ftotal]];
  48.     [display setText:[NSString stringWithFormat:@"%ld", Ptotal]];
  49. }
  50.  
  51. -(IBAction)clear:(id)sender{
  52.     Ftotal = 0;
  53.     Ptotal = 0;
  54.     Count = 0;
  55.     [screen setText:[NSString stringWithFormat:@"%ld", Ftotal]];
  56.     [display setText:[NSString stringWithFormat:@"%ld", Ptotal]];
  57. }
  58.  
  59. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement