mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-07 01:23:57 -05:00
Updated comments and made sure style was consistent
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
//ProjectEuler/C++/Headers/Problem4.hpp
|
||||
//ProjectEuler/ProjectEulerCPP/Headers/Problem4.hpp
|
||||
//Matthew Ellison
|
||||
// Created: 09-28-18
|
||||
//Modified: 07-14-19
|
||||
//Modified: 07-09-20
|
||||
//Find the largest palindrome made from the product of two 3-digit numbers
|
||||
//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,24 +32,28 @@
|
||||
|
||||
class Problem4 : public Problem{
|
||||
private:
|
||||
static int START_NUM;
|
||||
static int END_NUM;
|
||||
//Variables
|
||||
//Static variables
|
||||
static int START_NUM; //The first number to check
|
||||
static int END_NUM; //The last number to check
|
||||
//Instance variables
|
||||
std::vector<uint64_t> palindromes; //Holds all numbers that turn out to be palindromes
|
||||
public:
|
||||
//Constructor
|
||||
Problem4();
|
||||
virtual void solve();
|
||||
virtual std::string getString() const;
|
||||
virtual void reset();
|
||||
//Returns the list of all palindromes
|
||||
std::vector<uint64_t> getPalindromes() const;
|
||||
//Returns the largest palindrome
|
||||
uint64_t getLargestPalindrome() const;
|
||||
//Operational functions
|
||||
virtual void solve(); //Solve the problem
|
||||
virtual void reset(); //Reset the problem so it can be run again
|
||||
//Gets
|
||||
virtual std::string getString() const; //Return a string with the solution to the problem
|
||||
std::vector<uint64_t> getPalindromes() const; //Returns the list of all palindromes
|
||||
uint64_t getLargestPalindrome() const; //Returns the largest palindrome
|
||||
};
|
||||
|
||||
|
||||
/* Results:
|
||||
The largest palindrome is 906609
|
||||
It took 31.904 milliseconds to solve this problem.
|
||||
It took an average of 36.525 milliseconds to run this problem over 100 iterations
|
||||
*/
|
||||
|
||||
#endif //PROBLEM4_HPP
|
||||
|
||||
Reference in New Issue
Block a user