The joy of bug killing

I am very happy to inform everyone that I have finally killed a really particularly annoying bug that was killing my programming assignment.

It was one of those bugs that turns up and bothers you just when you’re starting to feel really pleased with yourself, and the stellar job you’ve done on the program so far. This particular bug decided to jump out at me and ruin my day just as I added the finishing touch to the assignment. The problem was the deceptively simple requirement that the program should have a nice little ‘Would you like to enter another route (Y/N)’ at the end. Yes ladies and gentlemen, all this particular part of the program had to do was ask for an input and start over if you indicated Y.

The problem lay in the fact that whilst the program ran through fine the first time it would skip the first input the second time around if you selected ‘Y’ (it exited fine if ‘N’). I was, of course, programming in C++ and I fixed the problem by replacing cin.getline(restart, 2) with cin.getline(restart, 2, ‘n’) which (correct me if I’m wrong) is strictly speaking THE SAME THING!!! Anyway, problem solved, no suddenly empty inputs, program no longer chucking a skitz and crashing. Hooray!

To those who don’t program I can’t express to you how annoying it is to get to the end of a project and then have something really stupidly simple screw you up. Its sort of like winning a marathon only to be disqualified because you forgot how to walk when it came to the receiving your accolades bit. So having proven that walking is the same as running only slower I have fixed my problem and vastly improved my mood.

More importantly I have discovered that ‘Mark Leung’s Crazy Computer Bug’ makes a surprisingly accurate reenactment of those bugs that sneak up on you when you least expect it… Only its never made me want to throw my computer out the window or cry.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s