# using the result of a UILabel after a calculation in another calculation in Xcode

I hope what I'm about makes sense. what I am trying to do is use the result of say a - b = c. Now "a" and "b" are both UITextfields and "C" is a UILabel.

I want to be able to use the result of "c" to take "a" place each time the calculation is run.

Example: 100 - 30 = 70, then the next time I want to add another figure in position "b", "a" is now result of "c".

Now I also want to keep the original result of "a" in the textfield I entered first so I have it as a reference point. but would like to have the "c" result to drop each time I enter a figure into "b". now how do I code this?

The first part I have but not the second part.

heres my first part of the code

-(IBAction)calculate:(id)sender { NSString *spCash = self.spendingCash.text; NSString *recAmount = self.receiptAmount.text; float cashFloat; float receiptFloat =[recAmount floatValue]; float spendingFloat = [spCash floatValue]; cashFloat = spendingFloat - receiptFloat; NSString *cashAv = [[NSString alloc]initWithFormat:@"$%.2f", cashFloat]; self.cashAvailable.text = cashAv;

I hope this makes sense.

Thanks for your time and look forward to reading some responses.

## Answers

Don't depend on storing data in UI elements.

Create properties (probably in your view controller) to represent the numbers that people enter and the results of your calculations. That way you can save whatever information you need and not depend on whether or not it's visible on the screen.