Which keyword is used to access the variable in namespace?
What is the output of this program?
1. #include2. using namespace std; 3. namespace extra 4. { 5. int i; 6. } 7. void i() 8. { 9. using namespace extra; 10. int i; 11. i = 9; 12. cout << i; 13. } 14. int main() 15. { 16. enum letter { i, j}; 17. class i { letter j; }; 18. ::i(); 19. return 0; 20. }
What is the output of this program?
1. #include2. using namespace std 3. namespace space 4. { 5. int x = 10; 6. } 7. namespace space 8. { 9. int y = 15; 10. } 11. int main(int argc, char * argv[]) 12. { 13. space::x = space::y =5; 14. cout << space::x << space::y; 15. }
What is the output of this program?
1. #include2. using namespace std; 3. namespace Box1 4. { 5. int a = 4; 6. } 7. namespace Box2 8. { 9. int a = 13; 10. } 11. int main () 12. { 13. int a = 16; 14. Box1::a; 15. Box2::a; 16. cout << a; 17. return 0; 18. }
What is the output of these program?
1. #include2. using namespace std; 3. namespace first 4. { 5. int x = 5; 6. int y = 10; 7. } 8. namespace second 9. { 10. double x = 3.1416; 11. double y = 2.7183; 12. } 13. int main () 14. { 15. using first::x; 16. using second::y; 17. bool a, b; 18. a = x > y; 19. b = first::y < second::x; 20. cout << a << b; 21. return 0; 22. }