//Programmer: Bo Bayles  Date: 15 November 2004
//File: lab13.cpp         Class: CS54 C
//Purpose: This program simulates a stopwatch and demonstrates the use
//  of classes.

#include "StopWatch.h"
#include <iostream>
using namespace std;

int main()
{
  char cA;
  StopWatch newWatch;
  //Declare variables for the user's entries and an object of class StopWatch.

  cout << endl << "Stop Watch Simulator" << endl;

  do
  {
    cout << endl << "Press enter to begin timing: ";
    cin.get(cA);
    //Get the user's keystroke.

    newWatch.start();
    //Start timing by calling start from the newWatch object.
    cout << endl << "Press enter to stop timing: ";
    cin.get(cA);
    newWatch.stop();
    //Stop timing by calling stop from the newWatch object.

    cout << endl << newWatch.getElapsedTime() << " seconds elapsed." << endl;
    newWatch.reset();
    //Reset by calling reset from the newWatch object

    cout << endl << "Would you like to time something else? (Y/N): ";
    cin.get(cA);
    cin.ignore(100, '\n');
    //Delete what's left in the input stream.
  }
  while(cA != 'n' && cA != 'N');
  //Loop until the user chooses to exit.

  cout << endl << "Exiting..." << endl;
  return 0;
}

