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