home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 4.ddi / SAMPLES / CPPTUTOR / SCOPERES.CP$ / SCOPERES
Encoding:
Text File  |  1991-12-12  |  406 b   |  18 lines

  1. // SCOPERES.CPP
  2.  
  3. // This is an example program from Chapter 2 of the C++ Tutorial. This
  4. //     program demonstrates the scope resolution operator.
  5.  
  6. #include <iostream.h>
  7.  
  8. int amount = 123;    // A global variable
  9.  
  10. void main()
  11. {
  12.    int amount = 456; // A local variable 
  13.  
  14.    cout << ::amount; // Print the global variable
  15.    cout << '\n';
  16.    cout << amount;   // Print the local variable
  17. }
  18.