#include <iostream>
#include <iomanip>
#include <string>
usingnamespace std;
constdouble R = 3; //global constant
int x = 20; //global variable
int y = 25; //global variable
void fun(char y) // parameter y hides global var y
{
string x = "TNCG012"; //local var x hides global var x
int k = 3;
cout << "In the fun's loop ..." << endl;
for(int i = 0; i < R; i++) {
int k = 10+i; //loop's local var k hides fun's local var k
cout << "y = " << y << " x = " << x
<< " k = " << k << endl;
}
cout << endl << "Out the fun's loop ..." << endl;
cout << "y = " << y << " x = " << x
<< " k = " << k << endl;
}
int main()
{
int x = 100; // local var x hides global var x
fun('a');
cout << endl << "In the main ..." << endl;
cout << "x = " << x << " y = " << y << endl;..........
//i understand everything until here butthis last statement
// when it Changes back to global variable? is it ::x? how?
cout << "Global x = " << ::x << endl;
return 0;
}