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:
@@ -85,6 +85,9 @@ void Problem30::solve(){
|
||||
|
||||
//Throw a flag to show the problem is solved
|
||||
solved = true;
|
||||
|
||||
//Save the results
|
||||
result << "The sum of all the numbers that can be written as the sum of the fifth powers of their digits is " << getSumOfList();
|
||||
}
|
||||
|
||||
//Reset the problem so it can be run again
|
||||
@@ -93,19 +96,6 @@ void Problem30::reset(){
|
||||
sumOfFifthNumbers.clear();
|
||||
}
|
||||
|
||||
//Return a string with the solution to the problem
|
||||
std::string Problem30::getString() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
if(!solved){
|
||||
throw Unsolved();
|
||||
}
|
||||
|
||||
std::stringstream results;
|
||||
results << "The sum of all the numbers that can be written as the sum of the fifth powers of their digits is " << getSumOfList();
|
||||
|
||||
return results.str();
|
||||
}
|
||||
|
||||
//This returns the top number to be checked
|
||||
uint64_t Problem30::getTopNum() const{
|
||||
//If the problem hasn't been solved throw an exception
|
||||
|
||||
Reference in New Issue
Block a user