title: iPhone calculator tutorial help, decimal style..again
body: <p>I am working on the iPhone calculator tutorial, and I am running into a problem with the display of numbers.</p>
  
  <p>The calculator screen "prints" the 2nd entered operand (number) right next to the first one causing some erroneous calculations as- currentNumber feeds off this string.  </p>
  
  <p>How can i get the numbers and even the operator (+,-,*,/) to all show up and still perform the calculation correctly?</p>
  
  <pre><code>- (IBAction)pressedDecimal:(id)sender {
      calculatorScreen.text = [calculatorScreen.text stringByAppendingString:@"."];
  }
  - (IBAction)pressedDigit:(id)sender  {
      calculatorScreen.text = [calculatorScreen.text stringByAppendingFormat:@"%d", [sender tag]];
      currentNumber = [calculatorScreen.text floatValue];
  }
  - (IBAction) pressedOperation: (id) sender {
      if (currentOperation == 0) result = currentNumber;
      else {
          switch (currentOperation) {
              case 1:
                  result = result + currentNumber;
                  break;
              case 2:
                  result = result - currentNumber;
                  break;
              case 3:
                  result = result * currentNumber;
                  break;
              case 4:
                  result = result / currentNumber;
                  break;
              case 5:
                  currentOperation = 0;
                  break;
          }
      }
      currentNumber = 0;
      calculatorScreen.text = [NSString stringWithFormat:@"%g", result];
      if ([sender tag] == 0) result = 0;
      currentOperation = [sender tag];
  }
  </code></pre>
  
  <p>OK, here is a fully entered string 1.11+2.22 - notice its placing it all together..</p>
  
  <p><img src="https://i.stack.imgur.com/GANmy.png" alt="Screenshot of fully entered string 1.11+2.22"></p>
  
  <p>Here is the finished calculation, which is wrong..id like to have the string show the operator - is the decimal problem something i should be using NSRange for?</p>
  
  <p><img src="https://i.stack.imgur.com/blR73.png" alt="screenshot two of finished calculation"></p>