Exemple #1
0
void getListOfSolutions()
{
	SBase* solution = 0;
	int i = 1;
	while(i++ <= EULER_PROBLEMS)
	{
		solution = getSolution(i);
		if(solution != 0)
		{
			cout << "Problem #" << solution->problemNumber() << "\n" << solution->title() << "\n\n";
			delete solution;
		}
	}
}
Exemple #2
0
void executeAllSolutions()
{
	SBase* solution = 0;
	int i = 1;
	int start = clock();
	int solutionsExecuted = 0;
	while(i++ <= EULER_PROBLEMS)
	{
		solution =getSolution(i);
		if(solution != 0)
		{
			cout << "Problem #" << solution->problemNumber() << "\n" << solution->title() << "\n\n";
			solution->execute();
			delete solution;
			solutionsExecuted++;
		}
	}
	int end = clock();
	cout << "Total of " << solutionsExecuted << " problems executed in " << (end - start) << " ticks (" << ((end - start) / (double)CLOCKS_PER_SEC) << " secs)" << endl << endl;
}