Teacher Name:Mr. Rung
Date of Lesson: January
Primary Focus
Using the following program, answer the questions below.
#include
//FUNCTION PROTOTYPES
void the-function(int g, int & p); //one integer is passed by value
//the other by reference
int main()
{
int k = 8, m = 8;
cout « "The value of k is "« k « endl; //initial value of k cout « "The value of m is "« m « endl; / /initial value of m
the-function(k, m);
cout « "After the function call \n" ;
cout « "k = " « k «endl;
cout « "m = " « m « endl;
return 0;
} //MAIN
void the-function (int g, int & p)
{
g = g + 2;
p = p + 5;
cout « "While in the function \n";
cout « "g = " « g «endl;
cout « "p = " « p «endl;
}//THE-FUNCTION