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

Problem 1

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

int i = 0;
int I = 1;

void f() {

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

   i = 10;
   I = 20;
}

int main() {

   int i = 2;
   int I = 3;

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

   f();

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

   return 0;
}
What output is produced?



cs101 senior TA 2005-10-24