import SecondTask interface SecondTask void searchForMaximumValu end i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "SecondTask.h"
@interface SecondTask ()
//- (void)searchForMaximumValue;
@end
@implementation SecondTask
- (void)searchForMaximumValue {
self.previousMaximumValue = self.maximumValue;
self.indexOfPreviousMaximumValue = self.indexOfMaximumValue;
self.maximumValue = nil;
self.indexOfMaximumValue = 0;
for (int i = 0; i < self.firstArray.count; i++) {
if (self.firstArray[i] > self.maximumValue) {
if (self.firstArray[i] >= self.previousMaximumValue) {
if (self.indexOfPreviousMaximumValue == i) {
if (self.secondArray[i] == [NSNumber numberWithInt:-1]) {
} else {
self.maximumValue = self.firstArray[i];
self.indexOfMaximumValue = i;
}
}
} else {
self.maximumValue = self.firstArray[i];
self.indexOfMaximumValue = i;
}
}
}
}
@end