diff --git a/Headers/Problem.hpp b/Headers/Problem.hpp index e903af1..40b6d1e 100644 --- a/Headers/Problem.hpp +++ b/Headers/Problem.hpp @@ -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 diff --git a/Source/Problem1.cpp b/Source/Problem1.cpp index 52b3471..cea180a 100644 --- a/Source/Problem1.cpp +++ b/Source/Problem1.cpp @@ -78,7 +78,7 @@ void Problem1::reset(){ std::string Problem1::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } //Create a string with the results and return it std::stringstream results; @@ -89,7 +89,7 @@ std::string Problem1::getString() const{ uint64_t Problem1::getSum() const{ //If the prblem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return fullSum; } diff --git a/Source/Problem10.cpp b/Source/Problem10.cpp index ef6053e..9ef9171 100644 --- a/Source/Problem10.cpp +++ b/Source/Problem10.cpp @@ -67,7 +67,7 @@ void Problem10::reset(){ std::string Problem10::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The sum of all the primes less than " << GOAL_NUMBER + 1 << " is " << sum; @@ -78,7 +78,7 @@ std::string Problem10::getString() const{ uint64_t Problem10::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sum; } diff --git a/Source/Problem11.cpp b/Source/Problem11.cpp index 9d47660..8fc26f9 100644 --- a/Source/Problem11.cpp +++ b/Source/Problem11.cpp @@ -188,7 +188,7 @@ void Problem11::reset(){ std::string Problem11::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The greatest product of 4 number in a line is " << mee::getProduct(greatestProduct) @@ -200,7 +200,7 @@ std::string Problem11::getString() const{ std::vector Problem11::getNumbers() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return greatestProduct; } @@ -209,7 +209,7 @@ std::vector Problem11::getNumbers() const{ int Problem11::getProduct() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return mee::getProduct(greatestProduct); } diff --git a/Source/Problem12.cpp b/Source/Problem12.cpp index 21b8577..940fd0e 100644 --- a/Source/Problem12.cpp +++ b/Source/Problem12.cpp @@ -82,7 +82,7 @@ void Problem12::reset(){ std::string Problem12::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The triangular number " << sum << " is a sum of all numbers >= " << counter - 1 << " and has " << divisors.size() << " divisors"; @@ -93,7 +93,7 @@ std::string Problem12::getString() const{ int64_t Problem12::getTriangularNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sum; } @@ -102,7 +102,7 @@ int64_t Problem12::getTriangularNumber() const{ int64_t Problem12::getLastNumberAdded() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return counter - 1; } @@ -111,7 +111,7 @@ int64_t Problem12::getLastNumberAdded() const{ std::vector Problem12::getDivisorsOfTriangularNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return divisors; } @@ -120,7 +120,7 @@ std::vector Problem12::getDivisorsOfTriangularNumber() const{ size_t Problem12::getNumberOfDivisors() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return divisors.size(); } diff --git a/Source/Problem13.cpp b/Source/Problem13.cpp index fad5797..b8e6fc6 100644 --- a/Source/Problem13.cpp +++ b/Source/Problem13.cpp @@ -291,7 +291,7 @@ void Problem13::reset(){ std::string Problem13::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -304,7 +304,7 @@ std::string Problem13::getString() const{ std::vector Problem13::getNumbers() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return nums; } @@ -313,7 +313,7 @@ std::vector Problem13::getNumbers() const{ mpz_class Problem13::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sum; } diff --git a/Source/Problem14.cpp b/Source/Problem14.cpp index d78abaf..9c43b04 100644 --- a/Source/Problem14.cpp +++ b/Source/Problem14.cpp @@ -97,7 +97,7 @@ void Problem14::reset(){ std::string Problem14::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -109,7 +109,7 @@ std::string Problem14::getString() const{ uint64_t Problem14::getLength() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return maxLength; } @@ -118,7 +118,7 @@ uint64_t Problem14::getLength() const{ uint64_t Problem14::getStartingNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return maxNum; } diff --git a/Source/Problem15.cpp b/Source/Problem15.cpp index 5fdbd12..e5b5a0d 100644 --- a/Source/Problem15.cpp +++ b/Source/Problem15.cpp @@ -92,7 +92,7 @@ void Problem15::reset(){ std::string Problem15::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -104,7 +104,7 @@ std::string Problem15::getString() const{ uint64_t Problem15::getNumberOfRoutes() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return numOfRoutes; } diff --git a/Source/Problem16.cpp b/Source/Problem16.cpp index 47ebcbf..b9367ad 100644 --- a/Source/Problem16.cpp +++ b/Source/Problem16.cpp @@ -81,7 +81,7 @@ void Problem16::reset(){ std::string Problem16::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -94,7 +94,7 @@ std::string Problem16::getString() const{ mpz_class Problem16::getNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return num; } @@ -103,7 +103,7 @@ mpz_class Problem16::getNumber() const{ int Problem16::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sumOfElements; } diff --git a/Source/Problem17.cpp b/Source/Problem17.cpp index 341222a..78cfd86 100644 --- a/Source/Problem17.cpp +++ b/Source/Problem17.cpp @@ -209,7 +209,7 @@ void Problem17::reset(){ std::string Problem17::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The number of letters is " << letterCount; @@ -220,7 +220,7 @@ std::string Problem17::getString() const{ uint64_t Problem17::getLetterCount() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return letterCount; } diff --git a/Source/Problem18.cpp b/Source/Problem18.cpp index 8175ff0..a3f18bb 100644 --- a/Source/Problem18.cpp +++ b/Source/Problem18.cpp @@ -151,7 +151,7 @@ void Problem18::reset(){ std::string Problem18::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -163,7 +163,7 @@ std::string Problem18::getString() const{ std::string Problem18::getPyramid(){ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -180,7 +180,7 @@ std::string Problem18::getPyramid(){ std::string Problem18::getTrail(){ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -237,7 +237,7 @@ std::string Problem18::getTrail(){ int Problem18::getTotal() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return actualTotal; } diff --git a/Source/Problem19.cpp b/Source/Problem19.cpp index e4e1210..c71156a 100644 --- a/Source/Problem19.cpp +++ b/Source/Problem19.cpp @@ -185,7 +185,7 @@ void Problem19::reset(){ std::string Problem19::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "There are " << totalSundays << " Sundays that landed on the first of the months from " << START_YEAR << " to " << END_YEAR; @@ -196,7 +196,7 @@ std::string Problem19::getString() const{ uint64_t Problem19::getTotalSundays() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return totalSundays; } diff --git a/Source/Problem2.cpp b/Source/Problem2.cpp index 3a8302b..5c3ce9e 100644 --- a/Source/Problem2.cpp +++ b/Source/Problem2.cpp @@ -75,7 +75,7 @@ void Problem2::reset(){ std::string Problem2::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The sum of the even Fibonacci numbers less than 4,000,000 is " << fullSum; @@ -86,7 +86,7 @@ std::string Problem2::getString() const{ uint64_t Problem2::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return fullSum; } diff --git a/Source/Problem20.cpp b/Source/Problem20.cpp index 3eb2ec2..e1582b5 100644 --- a/Source/Problem20.cpp +++ b/Source/Problem20.cpp @@ -79,7 +79,7 @@ void Problem20::reset(){ std::string Problem20::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; //Print the results @@ -92,7 +92,7 @@ std::string Problem20::getString() const{ mpz_class Problem20::getNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return num; } @@ -101,7 +101,7 @@ mpz_class Problem20::getNumber() const{ std::string Problem20::getNumberString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return num.get_str(); } @@ -110,7 +110,7 @@ std::string Problem20::getNumberString() const{ uint64_t Problem20::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sum; } diff --git a/Source/Problem21.cpp b/Source/Problem21.cpp index 9459ad1..b57f9ae 100644 --- a/Source/Problem21.cpp +++ b/Source/Problem21.cpp @@ -103,7 +103,7 @@ void Problem21::reset(){ std::string Problem21::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -119,7 +119,7 @@ std::string Problem21::getString() const{ std::vector Problem21::getAmicable() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return amicable; } @@ -128,7 +128,7 @@ std::vector Problem21::getAmicable() const{ uint64_t Problem21::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return mee::getSum(amicable); } diff --git a/Source/Problem22.cpp b/Source/Problem22.cpp index ab9e44c..a431b55 100644 --- a/Source/Problem22.cpp +++ b/Source/Problem22.cpp @@ -461,7 +461,7 @@ void Problem22::reset(){ std::string Problem22::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The answer to the question is " << mee::getSum(prod); @@ -472,7 +472,7 @@ std::string Problem22::getString() const{ std::vector Problem22::getNames() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return names; } @@ -481,7 +481,7 @@ std::vector Problem22::getNames() const{ uint64_t Problem22::getNameScoreSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return mee::getSum(prod); } diff --git a/Source/Problem23.cpp b/Source/Problem23.cpp index cb2928b..e05e35f 100644 --- a/Source/Problem23.cpp +++ b/Source/Problem23.cpp @@ -120,7 +120,7 @@ void Problem23::reset(){ std::string Problem23::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The answer is " << sum; @@ -131,7 +131,7 @@ std::string Problem23::getString() const{ uint64_t Problem23::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sum; } diff --git a/Source/Problem24.cpp b/Source/Problem24.cpp index bcaf285..86b3f83 100644 --- a/Source/Problem24.cpp +++ b/Source/Problem24.cpp @@ -69,7 +69,7 @@ void Problem24::reset(){ std::string Problem24::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; //Print the results @@ -81,7 +81,7 @@ std::string Problem24::getString() const{ std::vector Problem24::getPermutationsList() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return permutations; } @@ -90,7 +90,7 @@ std::vector Problem24::getPermutationsList() const{ std::string Problem24::getPermutation() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return permutations.at(NEEDED_PERM - 1); } diff --git a/Source/Problem25.cpp b/Source/Problem25.cpp index aa90aae..613effe 100644 --- a/Source/Problem25.cpp +++ b/Source/Problem25.cpp @@ -76,7 +76,7 @@ void Problem25::reset(){ std::string Problem25::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -89,7 +89,7 @@ std::string Problem25::getString() const{ mpz_class Problem25::getNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return number; } @@ -98,7 +98,7 @@ mpz_class Problem25::getNumber() const{ std::string Problem25::getNumberString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return number.get_str(); } @@ -107,7 +107,7 @@ std::string Problem25::getNumberString() const{ mpz_class Problem25::getIndex() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return index; } @@ -116,7 +116,7 @@ mpz_class Problem25::getIndex() const{ std::string Problem25::getIndexString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return index.get_str(); } @@ -125,7 +125,7 @@ std::string Problem25::getIndexString() const{ uint64_t Problem25::getIndexInt() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return index.get_ui(); } diff --git a/Source/Problem26.cpp b/Source/Problem26.cpp index b382b5f..04292eb 100644 --- a/Source/Problem26.cpp +++ b/Source/Problem26.cpp @@ -104,7 +104,7 @@ void Problem26::reset(){ std::string Problem26::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -118,7 +118,7 @@ std::string Problem26::getString() const{ unsigned int Problem26::getLongestCycle() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return longestCycle; } @@ -127,7 +127,7 @@ unsigned int Problem26::getLongestCycle() const{ unsigned int Problem26::getLongestNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return longestNumber; } diff --git a/Source/Problem27.cpp b/Source/Problem27.cpp index 4259e20..167d907 100644 --- a/Source/Problem27.cpp +++ b/Source/Problem27.cpp @@ -85,7 +85,7 @@ void Problem27::reset(){ std::string Problem27::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -100,7 +100,7 @@ std::string Problem27::getString() const{ int64_t Problem27::getTopA() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return topA; } @@ -109,7 +109,7 @@ int64_t Problem27::getTopA() const{ int64_t Problem27::getTopB() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return topB; } @@ -118,7 +118,7 @@ int64_t Problem27::getTopB() const{ int64_t Problem27::getTopN() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return topN; } diff --git a/Source/Problem28.cpp b/Source/Problem28.cpp index bc310b6..0c7c7ae 100644 --- a/Source/Problem28.cpp +++ b/Source/Problem28.cpp @@ -148,7 +148,7 @@ void Problem28::reset(){ std::string Problem28::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -161,7 +161,7 @@ std::string Problem28::getString() const{ std::vector> Problem28::getGrid() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return grid; } @@ -170,7 +170,7 @@ std::vector> Problem28::getGrid() const{ uint64_t Problem28::getSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sumOfDiagonals; } diff --git a/Source/Problem29.cpp b/Source/Problem29.cpp index ac06e51..bb00061 100644 --- a/Source/Problem29.cpp +++ b/Source/Problem29.cpp @@ -87,7 +87,7 @@ void Problem29::reset(){ std::string Problem29::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -100,7 +100,7 @@ std::string Problem29::getString() const{ unsigned int Problem29::getBottomA() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return BOTTOM_A; } @@ -109,7 +109,7 @@ unsigned int Problem29::getBottomA() const{ unsigned int Problem29::getTopA() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return TOP_A; } @@ -118,7 +118,7 @@ unsigned int Problem29::getTopA() const{ unsigned int Problem29::getBottomB() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return BOTTOM_B; } @@ -127,7 +127,7 @@ unsigned int Problem29::getBottomB() const{ unsigned int Problem29::getTopB() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return TOP_B; } @@ -136,7 +136,7 @@ unsigned int Problem29::getTopB() const{ std::vector Problem29::getUnique() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return unique; } diff --git a/Source/Problem3.cpp b/Source/Problem3.cpp index 776afa1..77da2cf 100644 --- a/Source/Problem3.cpp +++ b/Source/Problem3.cpp @@ -68,7 +68,7 @@ void Problem3::reset(){ std::string Problem3::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The largest factor of the number " << GOAL_NUMBER << " is " << factors[factors.size() - 1]; @@ -79,7 +79,7 @@ std::string Problem3::getString() const{ std::vector Problem3::getFactors() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return factors; } @@ -88,7 +88,7 @@ std::vector Problem3::getFactors() const{ uint64_t Problem3::getLargestFactor() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return *factors.end(); @@ -98,7 +98,7 @@ uint64_t Problem3::getLargestFactor() const{ uint64_t Problem3::getGoalNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return GOAL_NUMBER; } diff --git a/Source/Problem30.cpp b/Source/Problem30.cpp index a2d594f..ecd31e6 100644 --- a/Source/Problem30.cpp +++ b/Source/Problem30.cpp @@ -97,7 +97,7 @@ void Problem30::reset(){ std::string Problem30::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -110,7 +110,7 @@ std::string Problem30::getString() const{ uint64_t Problem30::getTopNum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return TOP_NUM; @@ -120,7 +120,7 @@ uint64_t Problem30::getTopNum() const{ std::vector Problem30::getListOfSumOfFifths() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sumOfFifthNumbers; @@ -130,7 +130,7 @@ std::vector Problem30::getListOfSumOfFifths() const{ uint64_t Problem30::getSumOfList() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } uint64_t sum = 0; diff --git a/Source/Problem31.cpp b/Source/Problem31.cpp index 5ab8dda..b7448ff 100644 --- a/Source/Problem31.cpp +++ b/Source/Problem31.cpp @@ -81,7 +81,7 @@ void Problem31::reset(){ std::string Problem31::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -94,7 +94,7 @@ std::string Problem31::getString() const{ int Problem31::getPermutations() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return permutations; } diff --git a/Source/Problem4.cpp b/Source/Problem4.cpp index 5c19f1a..8a1e68f 100644 --- a/Source/Problem4.cpp +++ b/Source/Problem4.cpp @@ -89,7 +89,7 @@ void Problem4::reset(){ std::string Problem4::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } //Print the results std::stringstream results; @@ -101,7 +101,7 @@ std::string Problem4::getString() const{ std::vector Problem4::getPalindromes() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return palindromes; } @@ -110,7 +110,7 @@ std::vector Problem4::getPalindromes() const{ uint64_t Problem4::getLargestPalindrome() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return *(palindromes.end() - 1); } diff --git a/Source/Problem5.cpp b/Source/Problem5.cpp index 4dc454d..e5f8d80 100644 --- a/Source/Problem5.cpp +++ b/Source/Problem5.cpp @@ -86,7 +86,7 @@ void Problem5::reset(){ std::string Problem5::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The smallest positive number evenly divisible by all numbers 1-20 is " << smallestNum; @@ -97,7 +97,7 @@ std::string Problem5::getString() const{ int Problem5::getNumber() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return smallestNum; } diff --git a/Source/Problem6.cpp b/Source/Problem6.cpp index cb1e888..01a7d10 100644 --- a/Source/Problem6.cpp +++ b/Source/Problem6.cpp @@ -72,7 +72,7 @@ void Problem6::reset(){ std::string Problem6::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The difference between the sum of the squares and the square of the sum of all numbers from 1-100 is " << abs(sumOfSquares - squareOfSum); @@ -83,7 +83,7 @@ std::string Problem6::getString() const{ uint64_t Problem6::getSumOfSquares() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return sumOfSquares; } @@ -92,7 +92,7 @@ uint64_t Problem6::getSumOfSquares() const{ uint64_t Problem6::getSquareOfSum() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return squareOfSum; } @@ -101,7 +101,7 @@ uint64_t Problem6::getSquareOfSum() const{ uint64_t Problem6::getDifference() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return abs(sumOfSquares - squareOfSum); } diff --git a/Source/Problem67.cpp b/Source/Problem67.cpp index 8003025..2da92b8 100644 --- a/Source/Problem67.cpp +++ b/Source/Problem67.cpp @@ -327,7 +327,7 @@ void Problem67::reset(){ std::string Problem67::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -339,7 +339,7 @@ std::string Problem67::getString() const{ std::string Problem67::getPyramid() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -356,7 +356,7 @@ std::string Problem67::getPyramid() const{ std::string Problem67::getTrail(){ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; @@ -413,7 +413,7 @@ std::string Problem67::getTrail(){ int Problem67::getTotal() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return actualTotal; } diff --git a/Source/Problem7.cpp b/Source/Problem7.cpp index cf32dd5..1b3afde 100644 --- a/Source/Problem7.cpp +++ b/Source/Problem7.cpp @@ -67,7 +67,7 @@ void Problem7::reset(){ std::string Problem7::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The " << NUMBER_OF_PRIMES << "th prime number is " << primes.at(primes.size() - 1); @@ -78,7 +78,7 @@ std::string Problem7::getString() const{ uint64_t Problem7::getPrime() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return *primes.end(); } diff --git a/Source/Problem8.cpp b/Source/Problem8.cpp index 91a80bd..68a2db0 100644 --- a/Source/Problem8.cpp +++ b/Source/Problem8.cpp @@ -99,7 +99,7 @@ void Problem8::reset(){ std::string Problem8::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; results << "The greatest product is " << maxProduct @@ -111,7 +111,7 @@ std::string Problem8::getString() const{ std::string Problem8::getLargestNums() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return maxNums; } @@ -120,7 +120,7 @@ std::string Problem8::getLargestNums() const{ uint64_t Problem8::getLargestProduct() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return maxProduct; } diff --git a/Source/Problem9.cpp b/Source/Problem9.cpp index 18ccd94..a3a8ec9 100644 --- a/Source/Problem9.cpp +++ b/Source/Problem9.cpp @@ -83,7 +83,7 @@ void Problem9::reset(){ std::string Problem9::getString() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } std::stringstream results; if(found){ @@ -101,7 +101,7 @@ std::string Problem9::getString() const{ int Problem9::getSideA() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return a; } @@ -110,7 +110,7 @@ int Problem9::getSideA() const{ int Problem9::getSideB() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return b; } @@ -119,7 +119,7 @@ int Problem9::getSideB() const{ int Problem9::getSideC() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return (int)c; } @@ -128,7 +128,7 @@ int Problem9::getSideC() const{ int Problem9::getProduct() const{ //If the problem hasn't been solved throw an exception if(!solved){ - throw unsolved(); + throw Unsolved(); } return a * b * (int)c; }