// Program to illustrate functions in C++ April 10, 2006 // Build a table that converts dollars to Euros. #include #include int main() { float exchange_rate; float dollars; // Loop index float increment; // Loop increment float Convert( float x, float y ); cout << "Enter current Exchange Rate (dollars to Euros)" << endl; cin >> exchange_rate; cout << "Enter increment for conversion table)" << endl; cin >> increment; // Print header for table cout << "Dollars Euros" << endl; // Build table for dollars to Euros in $20 increments for ( dollars = increment; dollars<=1000.0; dollars+=increment ) cout << setw( 4 ) << setprecision( 6 ) << dollars << " " << setw( 8 ) << setprecision( 5) << Convert( dollars, exchange_rate ) << endl; return 0; } // Definition of function Convert float Convert( float Amount, float Rate ) { return Amount*Rate; }