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,14 +1,14 @@
//ProjectEuler/C++/Headers/Problem20.hpp
//ProjectEuler/ProjectEulerCPP/Headers/Problem20.hpp
//Matthew Ellison
// Created: 11-07-18
//Modified: 07-14-19
//Modified: 07-09-20
//What is the sum of the digits of 100!?
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses
//This file contains a header from the gmp library. The library is used for large integers.
//You can find more information about them at https://gmplib.org/
//When compiling this file you need to have the gmp library installed as well as linking the libraries to your executable using the -lgmpxx and -lgmp flags
/*
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
@@ -36,25 +36,27 @@
class Problem20 : public Problem{
private:
//Variables
//Instance variables
mpz_class num; //Holds the number 100!
uint64_t sum; //The sum of the digits of num
public:
//Constructor
Problem20();
virtual void solve();
virtual std::string getString() const;
virtual void reset();
//Returns the number 100!
mpz_class getNumber() const;
//Returns the number 100! in a string
std::string getNumberString() const;
//Returns the sum of the digits of 100!
uint64_t getSum() 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
mpz_class getNumber() const; //Returns the number 100!
std::string getNumberString() const; //Returns the number 100! in a string
uint64_t getSum() const; //Returns the sum of the digits of 100!
};
/* Results:
100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
The sum of the digits is: 648
It took 8.300 microseconds to solve this problem.
It took an average of 4.094 microseconds to run this problem over 100 iterations
*/
#endif //PROBLEM20_HPP