Inital commit with existing files

This commit is contained in:
2020-06-06 16:59:20 -04:00
commit d416b0fe53
67 changed files with 7057 additions and 0 deletions

42
Headers/Problem.hpp Normal file
View File

@@ -0,0 +1,42 @@
//ProjectEuler/C++/Headers/Problem.hpp
//Matthew Ellison
// Created: 07-04-19
//Modified: 07-10-19
//This is an abstract base class to allow polymorphism for the individual problems
#ifndef PROBLEM_HPP
#define PROBLEM_HPP
#include <string>
#include "Stopwatch.hpp"
class Problem{
protected:
const std::string description; //Holds the description of the problem
mee::Stopwatch timer; //Used to determine your algorithm's run time
bool solved; //Holds true after the problem has been solved
class unsolved{}; //An exception class thrown if you try to access something before it has been solved
public:
//Constructors
Problem() : solved(false){
}
Problem(std::string description) : description(description), solved(false){
}
virtual ~Problem(){
}
virtual std::string getDescription() const{
return description;
}
virtual std::string getTime(){
return timer.getStr();
}
virtual void solve() = 0;
virtual std::string getString() const = 0;
};
#endif //PROBLEM_HPP