1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include <cstdlib>
11 #include <string>
12 #include <fstream>
13 #include <iostream>
14
15 int
product(int x,int y)16 product (int x, int y)
17 {
18 int result = x * y;
19 return result;
20 }
21
22 int
sum(int a,int b)23 sum (int a, int b)
24 {
25 int result = a + b;
26 return result;
27 }
28
29 int
strange_max(int m,int n)30 strange_max (int m, int n)
31 {
32 if (m > n)
33 return m;
34 else if (n > m)
35 return n;
36 else
37 return 0;
38 }
39
40 int
foo(int i,int j)41 foo (int i, int j)
42 {
43 if (strange_max (i, j) == i)
44 return product (i, j);
45 else if (strange_max (i, j) == j)
46 return sum (i, j);
47 else
48 return product (sum (i, i), sum (j, j));
49 }
50
51 int
main(int argc,char const * argv[])52 main(int argc, char const *argv[])
53 {
54
55 int array[3];
56
57 array[0] = foo (1238, 78392);
58 array[1] = foo (379265, 23674);
59 array[2] = foo (872934, 234);
60
61 return 0;
62 }
63