mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-07 01:23:57 -05:00
Updated how results are retrieved
This commit is contained in:
@@ -75,6 +75,9 @@ void Problem4::solve(){
|
||||
//Stop the timer
|
||||
timer.stop();
|
||||
|
||||
//Save the results
|
||||
result << "The largest palindrome is " << *(palindromes.end() - 1);
|
||||
|
||||
//Throw a flag to show the problem is solved
|
||||
solved = true;
|
||||
}
|
||||
@@ -85,18 +88,6 @@ void Problem4::reset(){
|
||||
palindromes.clear();
|
||||
}
|
||||
|
||||
//Return a string with the solution to the problem
|
||||
std::string Problem4::getString() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
if(!solved){
|
||||
throw Unsolved();
|
||||
}
|
||||
//Print the results
|
||||
std::stringstream results;
|
||||
results << "The largest palindrome is " << *(palindromes.end() - 1);
|
||||
return results.str();
|
||||
}
|
||||
|
||||
//Returns the list of all palindromes
|
||||
std::vector<uint64_t> Problem4::getPalindromes() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
|
||||
Reference in New Issue
Block a user