Complete listing of Functions03.cpp
/*File: Functions03.cpp This C++ program illustrates functions with value parameters and no return value This program displays the following text on the screen: In main a = 10 b = 20.1 In aFunction x = 10 y = 20.1 Change x and y Still in aFunction x = 100 y = 200.1 Back in main a = 10 b = 20.1 ************************************************/ #include <iostream> using namespace std; void aFunction(int x,double y){ cout << "In aFunction" << endl; cout << "x = " << x << " y = " << y << endl; cout << "Change x and y" << endl; x = 100; y = 200.1; cout << "Still in aFunction" << endl; cout << "x = " << x << " y = " << y << endl; }//end aFunction //---------------------------------------------// int main(){//Global main function. cout << "In main" << endl; int a = 10; double b = 20.1; cout << "a = " << a << " b = " << b << endl; aFunction(a,b); cout << "Back in main" << endl; cout << "a = " << a << " b = " << b << endl; return 0; }//end main function Listing 3 |