// Example namespaces.cpp // Show how to use namespaces to // organize global variables. #include using namespace std; namespace a { bool flag; int x; } namespace b { bool flag; int x; } int main() { a::flag = false; a::x = 3; b::flag = true; b::x = 4; cout << a::flag << " " << a::x << " " << b::flag << " " << b::x << endl; using namespace a; cout << flag << " " << x << endl; x += 3; cout << flag << " " << x << endl; b::x += 5; cout << b::x << endl; return EXIT_SUCCESS; }