/* testfunc02.cpp CIS 150 6/9/2005 David Klick This program demonstrates how to create and call a function that has an argument. */ #include #include using std::cout; using std::endl; using std::fixed; using std::setprecision; void display(double x); // function prototype int main(void) { double num = 9.87654321; display(num); // call function using variable display(5.5555); // call function using value display(2.0/3.0); // call function using expression return 0; } /* This function displays a double in fixed format with two digits after the decimal point. */ void display(double d) { cout << fixed << setprecision(2) << d << endl; return; // optional since no value is returned }