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++/Headers/Problem19.hpp
//ProjectEuler/ProjectEulerCPP/Headers/Problem19.hpp
//Matthew Ellison
// Created: 09-28-18
//Modified: 07-14-19
//Modified: 07-09-20
//How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
/*
You are given the following information, but you may prefer to do some research for yourself.
@@ -16,7 +16,7 @@ A leap year occurs on any year evenly divisible by 4, but not on a century unles
*/
//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
@@ -43,28 +43,31 @@ A leap year occurs on any year evenly divisible by 4, but not on a century unles
class Problem19 : public Problem{
private:
//Variables
//Variables
//Staic variables
//An easier way to return the days
enum DAYS {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, NUMBER_OF_DAYS, ERROR};
static unsigned int START_YEAR; //The start year
static unsigned int END_YEAR; //The stop year
//Instance variables
uint64_t totalSundays; //Keep track of the number of sundays
//Functions
//Return the day of the week that the date you pass into it is on
DAYS getDay(unsigned int month, unsigned int day, unsigned int year);
//Returns true if the year passed to it is a leap year
bool isLeapYear(unsigned int year);
//Functions
DAYS getDay(unsigned int month, unsigned int day, unsigned int year); //Return the day of the week that the date you pass into it is on
bool isLeapYear(unsigned int year); //Returns true if the year passed to it is a leap year
public:
//Constructors
Problem19();
virtual void solve();
virtual std::string getString() const;
virtual void reset();
//Returns the total sundays that were asked for
uint64_t getTotalSundays() 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
uint64_t getTotalSundays() const; //Returns the total sundays that were asked for
};
/* Results
There are 171 Sundays that landed on the first of the months from 1901 to 2000
It took 4.579 milliseconds to solve this problem.
It took an average of 4.749 milliseconds to run this problem over 100 iterations
*/
#endif //PROBLEM19_HPP