#include <iostream>
using namespace std;

#include "array.h"
typedef Array<int> iarray;

//#include "sfarray.h"
//typedef safeArray<int> iarray;

int main(int, char**) {      // for compiler: I know that main has
                             // arguments, but I don't use them
  const int num_days = 6;
  int temperature[num_days] = { 23, 28, 21, 33, 35, 27 };   // probably read in
  iarray all_temp(temperature, num_days);
  iarray not_too_hot = all_temp;
  void remove_hot(iarray&);

  remove_hot(not_too_hot);

  // iarray::operator<<() not yet defined
  cout << "Temperature of nice days: ";
  for (int day=0; day<not_too_hot.size(); day++)
    cout << " " << not_too_hot[day];
  cout << endl;
}

void remove_hot(iarray& day_temp) {
  const int too_hot = 30;
  int num_nice = 0;
  int day;

  for (day=0; day<day_temp.size(); day++) {
    if (day_temp[day] < too_hot)
      num_nice++;
  }

  iarray dummy(num_nice);      // works for num_nice==0 too:
                               // creates empty array!
  num_nice = 0;  
  for (day=0; day<day_temp.size(); day++) {
    if (day_temp[day] < too_hot)
      dummy[num_nice++] = day_temp[day];
  }
  day_temp = dummy;
}