#include <iostream>
using namespace std;
//hypthesis: Considering the last two lessons I think that it will again be treated with a copy and the original values will nto be updated showing arg1=arg2=arg3=-1
void Change(int, int, int);

int main()
{
   // 0. Print a message explaining the program;
   cout << "\nThis program provides a 'laboratory' in which\n"
        << "experiments can be performed on parameter-passing.\n";

   int arg1,
       arg2,
       arg3;

   // 1. Initialize arguments to -1;
   arg1 = arg2 = arg3 = -1;

   // 2. Display Arg1, Arg2, and Arg3 (before Change);
   cout << "\nBefore: arg1 = " << arg1
        << ", arg2 = " << arg2
        << ", arg3 = " << arg3 << endl;

   // 3. Call Change, passing it Arg1, Arg2, and Arg3 are arguments;
   Change(arg1, arg2, arg3);

   // 4. Display Arg1, Arg2, and Arg3 (following Change);
   cout << "\nAfter: arg1 = " << arg1
        << ", arg2 = " << arg2
        << ", arg3 = " << arg3 << "\n\n";
}

/*************************************************************************
 * Change is the 'lab' in which we experiment with parameter passing.    *
 *                                                                       *
 * Specification:                                                        *
 *    receive(caller): 3 integers, stored in Param1, Param2, Param3;     *
 *    return(caller): the (altered ???) values of Param1, Param2, Param3.*
 *************************************************************************/
void Change(int arg1, int arg2, int arg3)
{
    arg1 = 1;
    arg2 = 2;
    arg3 = 3;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: