Much like the previous Euler project solution, I was going for a low coupling high cohesion object oriented approach. Did I achieve that? Well, I'll leave that up to the reader to decide. However, it is another stand alone program that will sum up all the even terms of the Fibonacci sequence when the terms are below 4 million. I took the non-recursive approach because I was always bothered by the fact the the recursive approach can fill up the stack and run out of memory. I kn ow in school this is the most common approach when professors begin to teach recursion. It always bothered me though because your severely wasting the stack. However, recursion is a neat little trick that can really boggle the mind sometimes. I understand the fascination. Below is the problem statement and code for the readers' exploration.
"Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."
If you've been to the euler project you know how fun it can be. There are many solutions to the plethora of problems presented on the site. However, mine are not the most elegant but they get the job done as a non-verbose overly engineered self contained program. Essentially, I was focusing on good object oriented (OO) design and less on beautification. Below is the source code and if downloaded it should work as a self contained C++ program, albeit you can definitely trip it up if you're trying.
"If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000."
This is a small C++ program that plays with Boolean networks. "Think of the computation of this circuit as continuous, one that loops while observing the updated values of all the wires leaving the cells. The idea is to excite the circuit by “seeding” one wire’s value, that is, setting it to be true while all the rest are initially false, perform the cells’ computation that changes (possibly) all the wires’ current values to new ones, and then “probe” the output wires to look at their new values just after being set. The wires’ new values then become their current values, and the compute-probe-update cycle is repeated. Below is an image of the Boolean network."
A special thanks to Professor Neff for the idea.