My friends commissioned me to create a virtual set of dice for their Dungeons & Dragons game. I wrote the C++ program below, which was meant to take in the command line:
#d### [+ * [/2]]
Where the #s to the right of the 'd' indicate how many sides the die has, the # to the left of the 'd' indicates how many times to roll it (summing the results), and the * indicates a number to add to the final result.
However, since this is an application that takes its input from the command-line, I've had some difficulties debugging it with gdb and determining where the segmentation fault occurs. If any experts could shed some light on this issue, that would be much appreciated.
I was curious what an ideal Q/A thread would look like. So I wrote up a short program, threw in an error, and then tried to follow the "How to Ask..." article as closely as possible. Interesting results. :)