mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Updated how results are retrieved
This commit is contained in:
@@ -55,6 +55,9 @@ void Problem24::solve(){
|
||||
//Stop the timer
|
||||
timer.stop();
|
||||
|
||||
//Save the results
|
||||
result << "The 1 millionth permutation is " << permutations.at(NEEDED_PERM - 1);
|
||||
|
||||
//Throw a flag to show the problem is solved
|
||||
solved = true;
|
||||
}
|
||||
@@ -65,18 +68,6 @@ void Problem24::reset(){
|
||||
permutations.clear();
|
||||
}
|
||||
|
||||
//Return a string with the solution to the problem
|
||||
std::string Problem24::getString() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
if(!solved){
|
||||
throw Unsolved();
|
||||
}
|
||||
std::stringstream results;
|
||||
//Print the results
|
||||
results << "The 1 millionth permutation is " << permutations.at(NEEDED_PERM - 1);
|
||||
return results.str();
|
||||
}
|
||||
|
||||
//Returns a vector with all of the permutations
|
||||
std::vector<std::string> Problem24::getPermutationsList() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
|
||||
Reference in New Issue
Block a user