double test4() { string t0[] = { "06390061", "60960062", "39090270", "96900262", "00000212", "00222026", "66761201", "12022610" } ; vector <string> p0(t0, t0+sizeof(t0)/sizeof(string)); WorkingRabbits * obj = new WorkingRabbits(); clock_t start = clock(); double my_answer = obj->getEfficiency(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; double p1 = 3.2142857142857144; cout <<"Desired answer: " <<endl; cout <<"\t" << p1 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
double test2() { string t0[] = { "0999", "9099", "9909", "9990" } ; vector <string> p0(t0, t0+sizeof(t0)/sizeof(string)); WorkingRabbits * obj = new WorkingRabbits(); clock_t start = clock(); double my_answer = obj->getEfficiency(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; double p1 = 9.0; cout <<"Desired answer: " <<endl; cout <<"\t" << p1 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
int main() { WorkingRabbits test; vector<string> coll; coll.push_back("0999"); coll.push_back("9099"); coll.push_back("9909"); coll.push_back("9990"); cout << test.getEfficiency(coll) << endl; return EXIT_SUCCESS; }