1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
int findLowest(int x1, int x2, int x3, int x4, int x5) // I would use ... here if you are allowed, infinite variables
{
return GetLow(x5, GetLow(x4, GetLow(x3, GetLow(x1, x2)))); // Seems a little condensed but works!
}
int GetLow(int a1, int a2)
{
if(a1 < a2)
return a1;
return a2 // If they are the same, it won't matter then I assume
}
void main()
{
int x = findLowest(10, 15, 100, 7, 5);
cout << x;
getch();
}
|