brintos

brintos / llvm-project-archived public Read only

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