//scope2.cpp

#include <iostream>

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

int main()
{
   int a = 10;
   int b = 20;
   cout << "outermost block:      a=" << a << "  b=" << b << endl;

   for ( int i = 0; i < 3; i++ )  {
      cout << "begin first loop:     a=" << a << "  b=" << b << endl;
      static int a = 0;
      a++;
      b++;
      cout << "end first loop:       a=" << a << "  b=" << b << endl;
   }  // for i

   cout << "outermost block:      a=" << a << "  b=" << b << endl;

   for ( int j = 0; j < 3; j++ )  {
      cout << "begin first loop:     a=" << a << "  b=" << b << endl;
      int b = 0;
      a++;
      b++;
      cout << "end first loop:       a=" << a << "  b=" << b << endl;
   }  // for i

   cout << "outermost block:      a=" << a << "  b=" << b << endl;
} // function main