#include <iostream.h>
#include <math.h>
//function to find the maximum value
double min(double x, double y)
{
if ( x < y ) {
return x;
} else {
return y;
}
}
//function to find the minimum value
double max(double x, double y)
{
if ( x > y ) {
return x;
} else {
return y;
}
}
int main()
{
double a, b, c, amount, intermediate;
cout << "Input the a, b, c: " << endl;
cin >> a >> b >> c;
intermediate = a + b + c;
//the first condition
if ( intermediate >= 0 )
{
amount = 0.5 * max( a, max( b, c ) ) + a;
}
//the second condition
if (( intermediate < 0 ) && ( a >= 0 ))
{
amount = 2.1 * ( 1 - a * a ) + cos( b / ( c + 1 ) );
}
//the third condition
if (( intermediate < 0 ) && ( a < 0 ))
{
amount = a * a + min( b, c );
}
cin.get();
cout << "Final answer: " << amount << endl;
}