Listing 19 Leaves a bad_alloc exception uncaught to force terminate()

// exhaust3.cpp
#include <iostream.h>

main()
{
   for (int i = 0; ; ++i)
   {
      (void) new double[100];
      if ((i+1)%10 == 0)
         cout << (i+1) << " allocations" << endl;
   }
}

/* Output:
10 allocations
20 allocations
30 allocations
40 allocations
50 allocations
60 allocations
70 allocations
Abnormal program termination
*/
// End of File