// FILE: cons5a.cpp // // DESCRIPTION: // This program sets variables "pi" and "e" to the value of pi and e // using a function set_cons. Next it prints out those variables. // It illustrates: // pass-by-reference; // good coding practices using functions; // function prototypes; // projects. // // HISTORY: // 09/25/97: Leon van Dommelen: version 1.0.0 // 03/03/99: Leon van Dommelen: updated the comments //INCLUDES: #include // Include the definitions of cout and cin //PROTOTYPES: void set_cons(float &pi, float &e); // The function prototype for set_cons //FUNCTION DEFINITIONS: //Definition of the main function: void main(void) // The main program, in which execution starts { // Declarations: float pi = 0., e = 0.; // declare pi and e and set them to zero // Executable statements: // Set the correct values for pi and e: set_cons(pi, e); // Verify that the constants are set correctly: cout << "The constants are: pi = " << pi << "; e = " << e << endl; }