1 | #include <cstdlib> |
2 | #include <string> |
3 | #include <fstream> |
4 | #include <iostream> |
5 | |
6 | int |
7 | product (int x, int y) |
8 | { |
9 | int result = x * y; |
10 | return result; |
11 | } |
12 | |
13 | int |
14 | sum (int a, int b) |
15 | { |
16 | int result = a + b; |
17 | return result; |
18 | } |
19 | |
20 | int |
21 | strange_max (int m, int n) |
22 | { |
23 | if (m > n) |
24 | return m; |
25 | else if (n > m) |
26 | return n; |
27 | else |
28 | return 0; |
29 | } |
30 | |
31 | int |
32 | foo (int i, int j) |
33 | { |
34 | if (strange_max (m: i, n: j) == i) |
35 | return product (x: i, y: j); |
36 | else if (strange_max (m: i, n: j) == j) |
37 | return sum (a: i, b: j); |
38 | else |
39 | return product (x: sum (a: i, b: i), y: sum (a: j, b: j)); |
40 | } |
41 | |
42 | int |
43 | main(int argc, char const *argv[]) |
44 | { |
45 | |
46 | int array[3]; |
47 | |
48 | array[0] = foo (i: 1238, j: 78392); |
49 | array[1] = foo (i: 379265, j: 23674); |
50 | array[2] = foo (i: 872934, j: 234); |
51 | |
52 | return 0; |
53 | } |
54 | |