home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
353_02
/
scopeop.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-19
|
622b
|
30 lines
// Chapter 1 - Program 2
#include <iostream.h>
int index = 13;
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";
}
// 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