/* This shows examples of how exceptions work */
#include <iostream.h>
#include <stdio.h>
#include <math.h>
#include "File.h"

float hypot(float a, float b) throw() {
	if (a == 0 || b == 0)
		throw "hypot(): sides must be nonzero";
	if (a < 0 || b < 0)
		throw "hypot(): sides must be positive values";
	return sqrt(a*a + b*b);
}

int doStuff() {
	try {
		float f, g;
		cout << "Input sides of right triangle: ";
		cin >> f >> g;
		cout << hypot(f, g) << " is the answer" << endl;
	 }
	 catch (char *msg) {
	 	cerr << msg << endl;
		throw;
		return 1;
		
	 }
	 return 0;
}

void (*previous_terminate) ();

void my_terminate() {
  set_terminate(previous_terminate);
  cerr << "Why didn't you catch this!"<< endl;
  throw;
}

int main()
{
  //  previous_terminate = set_terminate(my_terminate);
  //  int retval = doStuff();
  //  cerr << (retval ? "It failed":"It worked") << endl;

    try {
    File dbase("taxes", "r");
    File dbase2("bigtaxes", "w");
    File records;
      }


  catch (const FileError & e) {
    e.response();
    throw; 
    return 1;
  }
  catch (...) {
    cerr << "My abort" << endl;
    throw;
  }
      return 0;

  

}
