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 (i, j) == i) 36 return product (i, j); 37 else if (strange_max (i, j) == j) 38 return sum (i, j); 39 else 40 return product (sum (i, i), sum (j, j)); 41 } 42 43 int 44 main(int argc, char const *argv[]) 45 { 46 47 int array[9]; 48 memset(array,0,9*sizeof(int)); 49 50 array[0] = foo (1238, 78392); 51 array[1] = foo (379265, 23674); 52 array[2] = foo (872934, 234); 53 array[3] = foo (1238, 78392); 54 array[4] = foo (379265, 23674); 55 array[5] = foo (872934, 234); 56 array[6] = foo (1238, 78392); 57 array[7] = foo (379265, 23674); 58 array[8] = foo (872934, 234); 59 60 return 0; 61 } 62