diff --git a/homework2/.kdev4/homework2.kdev4 b/homework2/.kdev4/homework2.kdev4 new file mode 100644 index 0000000..cc1a104 --- /dev/null +++ b/homework2/.kdev4/homework2.kdev4 @@ -0,0 +1,15 @@ +[CMake] +Build Directory Count=1 +Current Build Directory Index=0 +ProjectRootRelative=./ + +[CMake][CMake Build Directory 0] +Build Directory Path=file:///home/sajjad/Desktop/temp/SP4E_HW1/homework2/build +Build Type=Debug +CMake Binary=file:///usr/bin/cmake +Environment Profile= +Extra Arguments= +Install Directory= + +[Project] +VersionControlSupport=kdevgit diff --git a/homework2/homework2.kdev4 b/homework2/homework2.kdev4 new file mode 100644 index 0000000..aba3115 --- /dev/null +++ b/homework2/homework2.kdev4 @@ -0,0 +1,3 @@ +[Project] +Manager=KDevCMakeManager +Name=homework2 diff --git a/homework2/src/main.cc b/homework2/src/main.cc index e2db29a..8611c22 100644 --- a/homework2/src/main.cc +++ b/homework2/src/main.cc @@ -1,65 +1,66 @@ //main #include "ComputeArithmetic.hh" #include "ComputePi.hh" #include "print_series.h" #include "write_series.h" #include #include +#include using namespace std; int main(int argc, char ** argv){ //command line arguments: Type of series and N of terms. stringstream sstr; for (int i = 1 ; i < argc ; ++i){ sstr << argv[i] << " "; } string which_series; string which_dumper; int frequency; int maxiter; sstr >> which_series; sstr >> which_dumper; sstr >> frequency; sstr >> maxiter; Series * my_series = NULL; DumperSeries * my_dumper = NULL; if (which_series == "pi") my_series = new ComputePi(); else if (which_series == "arithmetic") my_series = new ComputeArithmetic(); else { cout<<"insert one of the two available options:" "\n\t arithmetic (to compute arithmetic series)" "\n\t pi (to compute Pi series)"<dump(); //double tmpi = my_series->compute(N); //cout<<"Result for the "< WriteSeries::WriteSeries(Series & series, int frequency, int maxiter): DumperSeries(series){ this->frequency = frequency; this->maxiter = maxiter; } void WriteSeries::dump(){ std::string separator = " "; std::string file_name = "data" + setSeparator(separator); - std::ofstream file(file_name); + std::ofstream file(file_name.c_str()); file<<"#i"<