project-euler

https://projecteuler.net/
Log | Files | Refs | README

commit 0fb942bb22f2a0042403e612868866359563df7f
parent 969cbb0ae24bb8bc25fa91c57c6b28dffc23fde5
Author: mpizzzle <m@michaelpercival.xyz>
Date:   Mon, 21 Sep 2020 19:46:00 +0100

fixing a few g++ warnings

Diffstat:
MEulerUtility.cpp | 6------
MEuler_3.cpp | 5+----
MEuler_7.cpp | 2--
3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/EulerUtility.cpp b/EulerUtility.cpp @@ -179,18 +179,12 @@ int EulerUtility::factorial(int n) bool EulerUtility::isPerfectSquare(llui n) { - if (n < 0) - return false; - llui tst = (llui)(sqrt(n) + 0.5); return tst*tst == n; } bool EulerUtility::isPerfectCube(llui n) { - if (n < 0) - return false; - llui tst = (llui)std::floor(std::pow(n, 1/3.) + 0.5); return n == tst * tst * tst; } diff --git a/Euler_3.cpp b/Euler_3.cpp @@ -7,7 +7,6 @@ llui lpf(llui x) bool is_prime; llui count = 1; - llui my_prime = 2; //set to first prime for(llui i = 3; count < x; i += 2) { @@ -21,7 +20,6 @@ llui lpf(llui x) return i; ++count; - my_prime = i; } } @@ -49,4 +47,4 @@ llui Euler::LargestPrimeFactor() std::sort (primes.begin(), primes.end()); return primes.back(); -}- No newline at end of file +} diff --git a/Euler_7.cpp b/Euler_7.cpp @@ -5,7 +5,6 @@ int Euler::Get10001stPrime() bool is_prime; int count = 2; //includes 2 & 3 - int my_prime = 2; //set to first prime for(int i = 5; count < 1000000; i += 2) { @@ -16,7 +15,6 @@ int Euler::Get10001stPrime() if(is_prime) { ++count; - my_prime = i; if (count == 10001) return i;