For my solution to this month’s Exercise I went binary. Several of the C language operators work at a binary level. Because the exercise was to make a binary, or bitwise, modification, I figured a binary operator would be in order.
Continue reading
Category Archives: Solution
Plotting Squares – Solution
The key to unlocking this month’s Exercise is not to go insane on the code that processes the solution. As I wrote in the Exercise post, with data analysis in C, it’s important to properly represent the data so that you can easily manipulate it.
Continue reading
Spelling Alphabet – Solution
This month’s task was to create code that translates spelling from a single word into the corresponding NATO phonetic alphabet words. For input such as hello the output would be something like:
Hotel Echo Lima Lima Oscar
Continue reading
Let’s Go Bowling – An Entire Game – Solution
To make the conversion between simulating a single frame of bowling and an entire game isn’t that simple, which is mostly due to calculating the dreaded 10th Frame.
Continue reading
Let’s Go Bowling – Solution
You may find my solution for this month’s Exercise to be more complex than necessary, but there’s a method to my madness.
Continue reading
Board of Chess – Solution
A chessboard is merely a two-dimensional array — a matrix — one where the rows and columns are the same size. As long as you can write code to output an 8-by-8 board, you can modify the code to reset the board’s size to any value.
Continue reading
Pattern Manipulation – Solution
This month’s Exercise was to create a cycle of numbers, values that repeat within a certain range. Of all the Exercises presented so far on this site, this one probably has the greatest number of solutions.
Continue reading
Round Numbers – Solution
This month’s Exercise required you to create three rounding functions: roundup(), rounddown(), and roundhalf(). Each one deals with a floating-point value in a specific way, but they all handle the basic rounding chore by typecasting a floating point variable to an integer.
Continue reading
Just Average – Solution
If you attempted to compile the code skeleton for this month’s Exercise, you most likely stumbled across the first problem to solve: The average() function requires a type.
Continue reading
Making Change – Solution
To solve this month’s Exercise you had to figure out a way to divvy up a dollar amount into the proper number of quarters, dimes, nickels, and pennies. As with many programming puzzles, a number of ways exist to code a solution. Click here to view mine.
Continue reading