Complete listing of Functions05.cpp
/*File: Functions05.cpp
This C++ program illustrates a function with
a parameter and a return value.
This program displays the following text on the
screen:
a = 2
a doubled = 4
************************************************/
#include <iostream>
using namespace std;
int doubleIt(int x){
return x + x;
}//end doubleIt
//---------------------------------------------//
int main(){//Global main function.
int a = 2;
cout << "a = " << a << endl;
cout << "a doubled = " << doubleIt(a) << endl;
return 0;
}//end main function
Listing 5
|