The objective is to sum the lowest 2 integers of 3 selected (-max?).
The code below is testing the sum of 3 integers portion and then I will attempt to -(max) to print the result required in my "result.text" field.
If there is a better way for me to be writing this your assistance is very much welcomed and appreciated.
What I have to in my attempt to achieve sum of lowest 2 integers is as follows:
I am not having success. Any assistance and expertise?
The code below is testing the sum of 3 integers portion and then I will attempt to -(max) to print the result required in my "result.text" field.
If there is a better way for me to be writing this your assistance is very much welcomed and appreciated.
Code:
-(IBAction)SubmitB;
{
int val = [month1.text intValue];
val = val+[month2.text intValue];
val = val+[month3.text intValue];
NSString *String = [[NSString alloc] initWithFormat:@"%i", val];
result.text = String;
[String release];
What I have to in my attempt to achieve sum of lowest 2 integers is as follows:
Code:
result.text = [month1.text + month2.text + month3.text] - max(month1.text,max(month2.text,month3.text));
I am not having success. Any assistance and expertise?
Last edited by a moderator: