// Program that tries to get two float values out of a function set_cons // This one works because the variables are passed by reference // #include void set_cons(float &pi, float &e) { pi=3.141593; e=2.718282; cout << "In function set_cons: pi = " << pi << "; e = " << e << endl; } void main(void) { float pi = 0.; // declare pi and set it first to zero float e = 0.; // declare e and set it first to zero cout << "In function main: pi = " << pi << "; e = " << e << endl; // We want to set the correct values of pi and e: set_cons(pi, e); // This is going to work: pass-by-reference cout << "In function main: pi = " << pi << "; e = " << e << endl; }