brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1014 B · b953498 Raw
62 lines · cpp
1#include <cstdlib>2#include <cstring>3#include <string>4#include <fstream>5#include <iostream>6 7int8product (int x, int y)9{10    int result = x * y;11    return result;12}13 14int15sum (int a, int b)16{17    int result = a + b;18    return result;19}20 21int22strange_max (int m, int n)23{24    if (m > n)25        return m;26    else if (n > m)27        return n;28    else29        return 0;30}31 32int33foo (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    else40        return product (sum (i, i), sum (j, j));41}42 43int44main(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