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,7 +1,7 @@
//ProjectEuler/C++/Source/Problem31.cpp
//ProjectEuler/ProjectEulerCPP/Source/Problem31.cpp
//Matthew Ellison
// Created: 06-19-20
//Modified: 06-19-20
//Modified: 07-09-20
//How many different ways can £2 be made using any number of coins?
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses
/*
@@ -28,12 +28,15 @@
#include "../Headers/Problem31.hpp"
//The value of coins we want
int Problem31::desiredValue = 200;
//Constructor
Problem31::Problem31() : Problem("How many different ways can 2 pounds be made using any number of coins?"){
permutations = 0;
}
//Solve the problem
void Problem31::solve(){
//If the problem has alread been solved do nothing and end the function
if(solved){
@@ -68,6 +71,13 @@ void Problem31::solve(){
solved = true;
}
//Reset the problem so it can be run again
void Problem31::reset(){
Problem::reset();
permutations = 0;
}
//Return a string with the solution to the problem
std::string Problem31::getString() const{
//If the problem hasn't been solved throw an exception
if(!solved){
@@ -84,8 +94,3 @@ std::string Problem31::getString() const{
int Problem31::getPermutations() const{
return permutations;
}
void Problem31::reset(){
Problem::reset();
permutations = 0;
}