I hope you didn’t find this month’s Exercise too difficult. I do occasionally like to toss in an easy one. But for me, the big task was getting the output just right.
Continue reading
Category Archives: Solution
Alphabedecimal Revisited – Solution
The challenge for this month’s Exercise is to count in “alphabedecimal,” generating output from AAAA through ZZZZ, without using nested loops or a complex if structure. Your solution must use a recursive function that handles flipping the digits, er, characters.
Continue reading
Scramble a String – Solution
For this month’s Exercise, my solution to the scramble() function requires a second array. You could code a scramble() function without using a second array (or storage buffer), swapping individual characters within the string, but I chose not to.
Continue reading
A Handy ASCII Table – Solution
My ASCII table program had several iterations. It’s easy to get carried away, but it’s also easy to be too skimpy on the information. This month’s Exercise is based on my current ASCII program, which has evolved over the years.
Continue reading
Check Your Stock Gains – Solution
The challenge for this month’s Exercise is to determine the greatest price gain for a stock during the trading day. The gain is calculated moving forward in time, from a low to a high. It’s easy to see with human eyeballs looking at a chart, but not so easy when you must code a solution.
Continue reading
Watch the Stock Market – Solution
Looks like your stock had a great day at the market. It bounced around, highs and lows, lots of nerves wracked and fingernails chewed, but the price ended higher on the day.
Continue reading
Unravel the Mystery Code – Solution
I hope you enjoyed crafting your solution for this month’s Exercise. It’s just for fun, as I assume no one is going to mess with C to such a degree that their code becomes so completely unrecognizable. Still, C coders are a mischievous bunch.
Continue reading
Balancing Accounts – Solution
I hope you had a wee bit of a struggle with your solution to this month’s Exercise. It involves a lot of decisions and proper steps in the right order to hold off on debits so that the bank account never dips below zero.
Continue reading
Positive, Negative, or Zero – Solution
Your challenge for this month’s Exercise is to write a sign() function, which returns 1, 0, or -1 depending on the sign of an integer. A relatively simple thing to code — I hope!
Continue reading
A Pair of Arrays – Solution
The challenge for this month’s Exercise is to initialize two different arrays to two sets of values. You should try to use only one loop and try to use a single statement to make the element assignments.
Continue reading