//scope.cpp

#include <iostream>

using namespace std;
void first(int a);
void second(int& b);

int a = 1;
int b = 2;

int main()
{
   cout << "main:      a=" << a << "  b=" << b << endl;
   first(b);
   cout << "main:      a=" << a << "  b=" << b << endl;
   return 0;
} // function main

void first(int a)
{
   cout << "first:     a=" << a << "  b=" << b << endl;
   int b = 5;
   cout << "first:     a=" << a << "  b=" << b << endl;
   second(a);
   cout << "first:     a=" << a << "  b=" << b << endl;
}  // function first

void second(int& b)
{
   cout << "second:    a=" << a << "  b=" << b << endl;
   a = a + 7;
   cout << "second:    a=" << a << "  b=" << b << endl;
   b = b + 11;   
   cout << "second:    a=" << a << "  b=" << b << endl;
}  // function second