#include #include using namespace std; // function to calculate "something" using this equation: // // 3 // f(x) = x + 10x + 5 // double f( double x ) { // body of the function double result = pow( x, 3 ) + 10 * x + 5; return result; } // 2 2 // g(x,y) = x - y // double g( double x, double y ) { return pow( x, 2 ) - pow( y, 2 ); } int main() { cout << "Enter a number for x: "; double x; cin >> x; double answer = f( x ); cout.precision( 8 ); // display exactly 8 digits cout << "Applying f(x), the result is " << answer << endl; cout.setf( ios_base::fixed ); cout.precision( 5 ); // display 5 digits after // the decimal point cout << "Applying f(x), the result is " << answer << endl; double r = g( x, answer ); cout << "Applying g(x, f(x)), the result is " << r << endl; return 0; }