scopeop.cpp
来自「Since the field of object oriented progr」· C++ 代码 · 共 31 行
CPP
31 行
// Chapter 1 - Program 2 - SCOPEOP.CPP
#include <iostream.h>
int index = 13;
int main()
{
float index = 3.1415;
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
::index = index + 7; // 3 + 7 should result in 10
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
return 0;
}
// Result of execution
//
// The local index value is 3.1415
// The global index value is 13
// The local index value is 3.1415
// The global index value is 10
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?