diff --git a/exercice_2/src/main.cc b/exercice_2/src/main.cc index 49af90b..f0613bc 100644 --- a/exercice_2/src/main.cc +++ b/exercice_2/src/main.cc @@ -1,51 +1,51 @@ /* created by Marti Bosch and Marc Schwaerzel*/ /* -------------------------------------------------------------------------- */ #include #include #include #include #include "compute_arithmetic.hh" #include "compute_pi.hh" #include "print_series.hh" #include "series.hh" using namespace std; /* -------------------------------------------------------------------------- */ int main(int argc, char **argv) { cout << "exercice 2" << endl; - cout << "please enter the following arguments: serie_type(1=arithmetic, 2=pi), maxiter" << endl; + cout << "please enter the following arguments: serie_type(arithmetic or pi), maxiter(N)" << endl; if (argc != 3) { std::cout << "\nincorrect number of input arguments\n" << std::endl; return EXIT_FAILURE; } -int serie_type = atoi(argv[1]); +string serie_type = argv[1]; int N = atoi(argv[2]); Series* my_object; -if (serie_type == 1){ +if (serie_type == "arithmetic"){ my_object = new ComputeArithmetic(); cout <<"I compute arithmetic"<< endl; } -else if (serie_type == 2){ +else if (serie_type == "pi"){ my_object = new ComputePi(); cout <<"\nI compute pi"<< endl; } double res = my_object->compute(N); cout << "result for test for ex 2.6:\t" << res <