/* testfunc13.cpp CIS 150 6/9/2005 David Klick This program demonstrates how to use default arguments. */ #include #include using std::cout; double power(double x, double y = 2.0); int main(void) { double a = 4.0; cout << "4 squared is " << power(a) << '\n'; cout << "4 cubed is " << power(a, 3.0) << '\n'; return 0; } /* Power function with default of squaring first argument. */ double power(double x, double y) { return pow(x, y); } /* Sample output: 4 squared is 16 4 cubed is 64 */