// Fig. 3.3: fig03_03.cpp // Creating and using a programmer-defined function. #include using std::cout; using std::endl; int square( int ); // function prototype int main() { // loop 10 times and calculate and output // square of x each time for ( int x = 1; x <= 10; x++ ) cout << square( x ) << " "; // function call cout << endl; return 0; // indicates successful termination } // end main int square( int y ) // y is a copy of argument to function { return y * y; // returns square of y as an int } // end function square