home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / INTRO28.CPP < prev    next >
C/C++ Source or Header  |  1992-02-18  |  584b  |  28 lines

  1. // INTRO28.CPP--Example from Chapter 3, "An Introduction to C++"
  2.  
  3. #include <iostream.h>
  4.  
  5. int main()
  6. {
  7.     float hours[52];
  8.     int week;
  9.  
  10.     // Initialize the array
  11.     for (week = 0; week < 52; week++)
  12.         hours[week] = 0;
  13.  
  14.     // Store four values in array
  15.     hours[0] = 32.5;
  16.     hours[1] = 44.0;
  17.     hours[2] = 40.5;
  18.     hours[3] = 38.0;
  19.  
  20.     // Retrieve values and show their addresses
  21.     cout << "Element "<< "\tValue " << "\tAddress\n";
  22.     for (week = 0; week < 4; week++)
  23.         cout << "hours[" << week << "]" << '\t'
  24.              << hours[week] << '\t' << &hours[week] << '\n';
  25.  
  26.     return 0;
  27. }
  28.