/* scope4.cpp * CS401 - Intro to Comp Sci * */ #include #include #include using namespace std; void maybeFlip(int, int&); int i = 1, y = 2; int main() { char a = 'q'; cout << "a = " << a << endl; cout << "i = " << i << endl; cout << "y = " << y << endl; if (y < 20) { int a = 5; maybeFlip(a,i); cout << " a = " << a << endl; cout << " i = " << i << endl; maybeFlip(y,a); cout << " a = " << a << endl; cout << " y = " << y << endl; } cout << "a = " << a << endl; cout << "i = " << i << endl; cout << "y = " << y << endl; getch(); } void maybeFlip(int a, int &y) { i = 20 + a; y++; if (a < 10) i = -i; }