My Horrifiying Creation

Yesterday morning I went in early to get some help with my C++ homework from my professor. The class had been assigned to write a program that took a year (an integer value from 1 to 3999, to keep things simple) and translate it into Roman Numerals. We were supposed to do this using three functions, if else statements, and a few while loops. I was having trouble with my code, so we had a look together yesterday.

It turns out my problems were:

1) I had mixed up || (“or”) and && (“and”), which I probably would have figured out on my own eventually.

2) I had been using the pow function from the cmath library. That part worked fine, but the function I was using it in wasn’t being sent the correct data.

3) It turns out I was using a recursive function call incorrectly. (This is the reason it was crashing Windows, and Windows wanted to report my program to Microsoft.)

4) I had written twice the required functions, and they kept calling each other. Not so much a problem exactly, but it’s a little beyond the scope of the class, and I should have commented better who was sending what.

5) Essentially, I wrote a howling beast beast that rips apart numbers and stitches them back together as letters using advanced techniques when I was just supposed to write a cute little translator using if else and loops. At the time it seemed like a good idea.

6) I might actually be a mad scientist.

Anyway, it’s on the way to functionality now. It will tear through and return the correct values for 1000 and 8 easily, but it still crashes on 943. I’m working on it, but I just wish Windows would stop trying to report on me…

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s