Wednesday, November 10, 2010

Coding Journey: Euler Problem 22

Last night I decided that I wanted to install some of my old games on my computer.  I found out that I've lost the file I had saved containing all of the keys to my pc games (all legal games and keys, fyi).  So many keys lost!

I hate drm.  It makes games more trouble than they're worth.  It still angers me to no end that I can't play Half-Life or Portal without an internet connection.

Anyway.

I spent some time last night and this morning working on problem 22 of Project Euler.  It's in C++ because I figured the speed would be an advantage in processing everything.

It took me a while to figure out the answer, mostly because I was mistakenly using the ASCII values of each word in my calculations rather than alphabetic values (e.i. a = 1, b = 2, c = 3, ect).

Once I got it working, I went through and tried to comment most of it, but I have to say this whole program seems clunky to me.  It works, but I think I could've done a better job.  Anyway, here's my solution, for your coding pleasure.