mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Updated comments and made sure style was consistent
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user