//--------------------------------------------------------------------
// dynamic.cpp
//--------------------------------------------------------------------

// Allocates an array whose length is specified at run-time by the // user.
#include <iostream.h>
void main() { int listSize; // Input list size double *list; // Pointer to dynamically allocated array
// Get the size of array needed. cout << endl << "Enter the array size: "; cin >> listSize;
// Allocate an array of the specified size. list = new double [listSize];
// Read in the array elements. cout << "Enter the array elements: "; for ( int j = 0 ; j < listSize ; j++ ) cin >> list[j];
// Output the elements in the array. for ( int k = 0 ; k < listSize ; k++ ) cout << list[k] << endl; }