Added myexeption to throw errors and show using MyExeption class.

This commit is contained in:
Christian
2019-03-01 11:12:44 +01:00
parent c0c6bf63a0
commit b19c03f524
10 changed files with 76 additions and 32 deletions
+8 -3
View File
@@ -8,6 +8,8 @@
#include "simulation.hpp"
#include "myexeption.h"
using namespace std;
@@ -18,9 +20,12 @@ int main(int argc, const char * argv[]) {
double duration;
start = clock();
Simulation Sim;
Sim.doit();
try {
Simulation Sim;
Sim.doit();
} catch (MyException& caught) {
cout<<caught.what()<<endl;
}
duration = ( clock() - start ) / (double) CLOCKS_PER_SEC;
cout<<"Duration: "<< duration <<'\n';