Updated comments and made sure style was consistent

This commit is contained in:
2020-07-10 13:36:16 -04:00
parent 7257a118d4
commit c72754dcf8
65 changed files with 1160 additions and 747 deletions

View File

@@ -1,11 +1,11 @@
//ProjectEuler/C++/Source/Problem7.cpp
//ProjectEuler/ProjectEulerCPP/Source/Problem7.cpp
//Matthew Ellison
// Created: 09-28-18
//Modified: 07-14-19
//Modified: 07-09-20
//What is the 10001th prime number?
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses
/*
Copyright (C) 2019 Matthew Ellison
Copyright (C) 2020 Matthew Ellison
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -32,11 +32,14 @@
#include "../Headers/Problem7.hpp"
//The index of the prime number to find
uint64_t Problem7::NUMBER_OF_PRIMES = 10001;
//Constructor
Problem7::Problem7() : Problem("What is the 10001th prime number?"){
}
//Solve the problem
void Problem7::solve(){
//If the problem has already been solved do nothing and end the function
if(solved){
@@ -55,6 +58,12 @@ void Problem7::solve(){
solved = true;
}
//Reset the problem so it can be run again
void Problem7::reset(){
Problem::reset();
}
//Return a string with the solution to the problem
std::string Problem7::getString() const{
//If the problem hasn't been solved throw an exception
if(!solved){
@@ -65,6 +74,7 @@ std::string Problem7::getString() const{
return results.str();
}
//Returns the requested prime number
uint64_t Problem7::getPrime() const{
//If the problem hasn't been solved throw an exception
if(!solved){
@@ -72,7 +82,3 @@ uint64_t Problem7::getPrime() const{
}
return *primes.end();
}
void Problem7::reset(){
Problem::reset();
}