diff --git a/Homework2/src/compute_pi.hh b/Homework2/src/compute_pi.hh index e69de29..9585f5b 100644 --- a/Homework2/src/compute_pi.hh +++ b/Homework2/src/compute_pi.hh @@ -0,0 +1,12 @@ +#ifndef COMPUTE_PI_HH +#define COMPUTE_PI_HH + +#include "series.hh" + +class compute_pi: public Series +{ +public: + double compute(unsigned int N); +}; + +#endif diff --git a/Homework2/src/main.cc b/Homework2/src/main.cc index 0bc725f..2cceb55 100644 --- a/Homework2/src/main.cc +++ b/Homework2/src/main.cc @@ -1,20 +1,21 @@ #include #include +#include #include "compute_arithmetic.hh" int main(int argc, char ** argv) { std::string serie_type = argv[1]; - unsigned long N = atof (argv[2]); // max number of iteration entered as input + unsigned long N = abs(atof (argv[2])); // max number of iteration entered as input if (serie_type == "arithmetic") { compute_arithmetic my_serie; double result = my_serie.compute(N); // sum over 10 std::cout << result << std::endl; } else { std::cout << "Serie type not implemented yet" << std::endl; abort(); } return 0; }