// File: inclass18.cpp
// This program tests the Counter class defined in the exercise handout.
//
// Class: CS 210                     Instructor: Drs. Hwang & Roberts
// Assignment: Programming exercise  Date : March 19 & 20, 2007
// Programmer(s): <fill in your name(s)>

#include <iostream>      // Defines cin, cout
#include "counter.h"     // Defines Counter class
using namespace std;

int main ()
{
   Counter up,         // Default counter for testing increment
           down (5);   // Explicit-value counter for testing decrement
   int i, j;           // Loop counters

   cout << "\nBeginning test of Counter class\n\n";

   cout << "The up counter value is " << up.Value() << endl;
   cout << "The down counter value is " << down.Value() << endl;

   cout << "\nTest increment of up counter:\n";
   i = 1;
   while( i <= 5)
   {
      up.Increment();
      up.Write(cout);
      i++;
   }  // end while

   cout << "\nTest decrement of down counter:\n";
   j = 1;
   while (j <= 6)  // the last one should give an error message
   {
      down.Decrement();
      down.Write(cout);
      j++;
   }  // end while

   cout << "\nEnd of test\n";
   return 0;
}  // end main
