# include # include # include using namespace std; double f ( double x ); int main ( ) // // BRACKET is a program which allows the user to type in values of X // at which the value of F(X) should be printed. // // The program continues to accept input until the user types CTRL-D. // // This program uses the function F(X) = COS(X) - X as an example. // { double x; cout << "\n"; cout << "BRACKET:\n"; cout << " Enter a value X, to receive a function value F(X).\n"; cout << " Terminate with a CTRL-D or end-of-file.\n"; while ( true ) { cin >> x; if ( cin.eof ( ) ) { break; } cout << " F(" << x << ") = " << f ( x ) << "\n"; } return 0; } double f ( double x ) { double value; value = cos ( x ) - x; return value; }