#import "ViewController.h"
@interface Viewcontroller ()
@property (Weak, nonatomic) Iboutlet Uitextfield *one;//The first text to be entered this box uses the text button
@property (Weak, nonatomic) Iboutlet Uitextfield *two;//can enter the second text this box uses the text button
@property (Weak, nonatomic) Iboutlet Uitextfield *three;//can enter the third article box with the text button
@property (Weak, nonatomic) Iboutlet Uitextfield *max;//can output the maximum value of the text box with the textbox with the text button
@property (Weak, nonatomic) Iboutlet Uitextfield *pingjun;//the text box with the output average
@property (Weak, nonatomic) Iboutlet Uitextfield *min;//can output a text box with a minimum value
@end
@implementation Viewcontroller
-(Ibaction) Max: (ID) Sender {//Use the button button to click this button to get the maximum value
int a=self.one.text.intvalue;//assigns the value entered in the first text box to a
int b=self.two.text.intvalue;//assigns the value entered in the second text box to B
int c=self.three.text.intvalue;//assigns the value entered in the third text box to C
if (a>b) {//Here is a comparison method of three numbers in C language
if (a>c) {
Self.max.text=[nsstring stringwithformat:@ "%d", a];
}
Else
Self.max.text=[nsstring stringwithformat:@ "%d", c];
}else
if (b>c) {
Self.max.text=[nsstring stringwithformat:@ "%d", b];
}else
Self.max.text=[nsstring stringwithformat:@ "%d", c];
}
-(Ibaction) Pingjun: (ID) Sender {//Use the button button to click this button to get the minimum value
int a= ([self.one.text intvalue]+[self.two.text intvalue]+[self.three.text intvalue])/3;//directly adds the values entered in three text divided by 39.
Self.pingjun.text=[nsstring stringwithformat:@ "%d", a];
}
-(ibaction) min: (ID) Sender {//Use the button button to click this button to get the minimum value
int a=self.one.text.intvalue;
int b=self.two.text.intvalue;
int c=self.three.text.intvalue;
if (a<b) {
if (a<c) {
Self.min.text=[nsstring stringwithformat:@ "%d", a];
}
Else
Self.min.text=[nsstring stringwithformat:@ "%d", c];
}else
if (b<c) {
Self.min.text=[nsstring stringwithformat:@ "%d", b];
}else
Self.min.text=[nsstring stringwithformat:@ "%d", c];
}
-(void) Viewdidload {
[Super Viewdidload];
Additional setup after loading the view, typically from a nib.
}
-(void) didreceivememorywarning {
[Super didreceivememorywarning];
Dispose of any resources the can be recreated.
}
@end
iOS makes a three number to find the average maximum number of minimum number