Changed exception to Unsolved to fit with naming convention

This commit is contained in:
2020-07-19 13:23:57 -04:00
parent 0caa043b59
commit 22871b71e9
33 changed files with 112 additions and 104 deletions

View File

@@ -33,7 +33,7 @@ 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
class Unsolved{}; //An exception class thrown if you try to access something before it has been solved
public:
//Constructors
Problem() : solved(false){
@@ -48,9 +48,17 @@ public:
return description;
}
virtual std::string getTime(){
//If the problem hasn't been solved throw an exception
if(!solved){
throw Unsolved();
}
return timer.getStr();
}
virtual mee::Stopwatch getTimer(){
//If the problem hasn't been solved throw an exception
if(!solved){
throw Unsolved();
}
return timer;
}
//Reset the problem so it can be run again