mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Updated comments and made sure style was consistent
This commit is contained in:
@@ -1,8 +1,25 @@
|
||||
//ProjectEuler/C++/Headers/Problem.hpp
|
||||
//ProjectEuler/ProjectEulerCPP/Headers/Problem.hpp
|
||||
//Matthew Ellison
|
||||
// Created: 07-04-19
|
||||
//Modified: 07-10-19
|
||||
//Modified: 07-09-20
|
||||
//This is an abstract base class to allow polymorphism for the individual problems
|
||||
/*
|
||||
Copyright (C) 2020 Matthew Ellison
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PROBLEM_HPP
|
||||
#define PROBLEM_HPP
|
||||
@@ -25,9 +42,11 @@ public:
|
||||
Problem(std::string description) : description(description), solved(false){
|
||||
|
||||
}
|
||||
//Destructor
|
||||
virtual ~Problem(){
|
||||
|
||||
}
|
||||
//Gets
|
||||
virtual std::string getDescription() const{
|
||||
return description;
|
||||
}
|
||||
@@ -37,12 +56,14 @@ public:
|
||||
virtual mee::Stopwatch getTimer(){
|
||||
return timer;
|
||||
}
|
||||
virtual void solve() = 0;
|
||||
virtual std::string getString() const = 0;
|
||||
//Reset the problem so it can be run again
|
||||
virtual void reset(){
|
||||
timer.reset();
|
||||
solved = false;
|
||||
}
|
||||
//Pure virtual functions
|
||||
virtual void solve() = 0; //Solve the problem
|
||||
virtual std::string getString() const = 0; //Return a string with the solution to the problem
|
||||
};
|
||||
|
||||
#endif //PROBLEM_HPP
|
||||
|
||||
Reference in New Issue
Block a user