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