From c4434fec5903e73e36267ee640e19c4d08eeda0e Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 3 Jul 2021 17:03:13 -0400 Subject: [PATCH] Fixed a few typoes --- headers/Problems/Problem27.hpp | 3 ++- src/Problems/Problem12.cpp | 5 +---- src/Problems/Problem27.cpp | 7 ++++++- src/Problems/Problem29.cpp | 2 +- src/Problems/Problem3.cpp | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/headers/Problems/Problem27.hpp b/headers/Problems/Problem27.hpp index 4d99771..9faae1b 100644 --- a/headers/Problems/Problem27.hpp +++ b/headers/Problems/Problem27.hpp @@ -1,7 +1,7 @@ //ProjectEuler/ProjectEulerCPP/headers/Problems/Problem27.hpp //Matthew Ellison // Created: 09-14-19 -//Modified: 07-02-21 +//Modified: 07-03-21 //Find the product of the coefficients, |a| < 1000 and |b| <= 1000, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0. //Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses /* @@ -49,6 +49,7 @@ public: int64_t getTopA() const; //Returns the top A that was generated int64_t getTopB() const; //Returns the top B that was generated int64_t getTopN() const; //Returns the top N that was generated + int64_t getProduct() const; //Returns the product of A and B for the answer }; diff --git a/src/Problems/Problem12.cpp b/src/Problems/Problem12.cpp index 694299d..5b30e8b 100644 --- a/src/Problems/Problem12.cpp +++ b/src/Problems/Problem12.cpp @@ -93,10 +93,7 @@ int64_t Problem12::getTriangularNumber() const{ } //Get the final number that was added to the triangular number int64_t Problem12::getLastNumberAdded() const{ - //If the problem hasn't been solved throw an exception - if(!solved){ - throw Unsolved("You must solve the problem before you can see the last number added to get the triangular number"); - } + solvedCheck("last number added to get the triangular number"); return counter - 1; } //Returns the list of divisors of the requested number diff --git a/src/Problems/Problem27.cpp b/src/Problems/Problem27.cpp index a09fc58..f3d9eff 100644 --- a/src/Problems/Problem27.cpp +++ b/src/Problems/Problem27.cpp @@ -1,7 +1,7 @@ //ProjectEuler/ProjectEulerCPP/src/Problems/Problem27.cpp //Matthew Ellison // Created: 09-14-19 -//Modified: 07-02-21 +//Modified: 07-03-21 //Find the product of the coefficients, |a| < 1000 and |b| <= 1000, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0. //Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses /* @@ -106,3 +106,8 @@ int64_t Problem27::getTopN() const{ solvedCheck("largest N"); return topN; } +//Returns the product of A and B for the answer +int64_t Problem27::getProduct() const{ + solvedCheck("product of A and B"); + return topA * topB; +} diff --git a/src/Problems/Problem29.cpp b/src/Problems/Problem29.cpp index c0a815f..9708c91 100644 --- a/src/Problems/Problem29.cpp +++ b/src/Problems/Problem29.cpp @@ -118,7 +118,7 @@ std::vector Problem29::getUnique() const{ solvedCheck("the unique values for a^b"); return unique; } -//Returns the number of unique value for a^b +//Returns the number of unique values for a^b size_t Problem29::getNumUnique() const{ solvedCheck("the number of unique values for a^b"); return unique.size(); diff --git a/src/Problems/Problem3.cpp b/src/Problems/Problem3.cpp index de0a6d6..53f0458 100644 --- a/src/Problems/Problem3.cpp +++ b/src/Problems/Problem3.cpp @@ -1,4 +1,4 @@ -//ProjectEuler/ProjectEulerCPP/Source/Problem3.cpp +//ProjectEuler/ProjectEulerCPP/src/Problems/Problem3.cpp //Matthew Ellison // Created: 09-28-18 //Modified: 07-02-21