next up previous
Next: Problem 4 Up: TwelfthWeek Previous: Problem 2

Problem 3

#include <iostream>
#include <string>
using namespace std;

int i = 0;

int main() {
   int i = 1;
   cout << "i: " << i << endl;
   
   {
      cout << "i: " << i << endl;
      int i = 2;
      cout << "i: " << i << endl;
    
      {
         cout << "i: " << i << endl;
	 int i = 3;
	 cout << "i: " << i << endl;	
      }

      cout << "i: " << i << endl;
   }

   cout << "i: " << i << endl;
   cout << "i: " <<::i << endl;

   return 0;
}
What output is produced?



cs101 senior TA 2005-10-24