brintos

brintos / llvm-project-archived public Read only

0
0
Text · 755 B · c883ce8 Raw
54 lines · cpp
1#include <cstdlib>2#include <string>3#include <fstream>4#include <iostream>5 6int7product (int x, int y)8{9    int result = x * y;10    return result;11}12 13int14sum (int a, int b)15{16    int result = a + b;17    return result;18}19 20int21strange_max (int m, int n)22{23    if (m > n)24        return m;25    else if (n > m)26        return n;27    else28        return 0;29}30 31int32foo (int i, int j)33{34    if (strange_max (i, j) == i)35        return product (i, j);36    else if (strange_max  (i, j) == j)37        return sum (i, j);38    else39        return product (sum (i, i), sum (j, j));40}41 42int43main(int argc, char const *argv[])44{45 46    int array[3];47 48    array[0] = foo (1238, 78392);49    array[1] = foo (379265, 23674);50    array[2] = foo (872934, 234);51 52    return 0;53}54