home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / C / ANSICPP.ZIP / EX03002.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-24  |  443 b   |  17 lines

  1. // ex03002.cpp
  2. // the C++ free store: new and delete with an array
  3. #include <iostream.h>
  4.  
  5. main()
  6. {
  7.     int *birthday = new int[3];    // get memory for a date array
  8.     birthday[0] = 6;              // assign a value to the date
  9.     birthday[1] = 24;
  10.     birthday[2] = 1940;
  11.     cout << "I was born on "      // display the date
  12.          << birthday[0] << '/'
  13.          << birthday[1] << '/'
  14.          << birthday[2];
  15.     delete birthday;    // return memory to the free store
  16. }
  17.