As a wrap-up for my ctype questions, this month’s Exercise is to write a ctype function that converts lowercase Greek letters to uppercase and vice-versa. This challenge isn’t a steep hill to climb, once you know the pattern of Unicode Greek letter values, and ignore the required accent and breathing marks that frequently adorn various letters.
Continue reading
Category Archives: Solution
That Series That Lacks a Name but Equals 5e – Solution
Once again, I dive into the murky waters of mathematics for this month’s Exercise. The challenge is to code the Series That Has No Name (STHNN), which converges on the value 5e.
Continue reading
Pointers to Multi-Dimension Arrays – Solution
The challenge for this month’s Exercise is to use pointers to work through a multi-dimensional array. As I mentioned in the exercise post, multi-dimensional arrays are all stored as a single-dimension where the compiler calculates offsets for rows and columns (and more) for you.
Continue reading
A Little Bit Off the Sides – Solution
The C language woefully lacks a trim() or similar string manipulation function. Rather than let it flail in absent envy, your task for this month’s Exercise is to code such a function. The goal is to remove whitespace characters from either end of a string.
Continue reading
What is the Largest Value – Solution
Once again, the challenge for this month’s exercise is to unravel a math puzzle. This time, the puzzle reads like this:
Continue reading
Pulling Numbers from a String – Solution
This month’s C programming exercise is to extract numbers from a string. Specifically, your task is to code the extract() function that returns the address of a digit found in a string. This function must also be capable of repeat calls to continue locating digits within the same string.
Continue reading
Is It a “Real” Triangle? – Solution
The challenge for this month’s Exercise is to generate three random values and determine if they work as sides of a valid triangle. To make this determination, you must consider three types of triangles and test the generated values for each.
Continue reading
Which is Greatest? – Solution
The task for this month’s Exercise is to write a function, greatest(), that returns the largest of three values. While this task could be done easily with an if-else construction, the second part of the challenge is to write the entire thing as a single ternary statement. How’d you do?
Continue reading
Having Fun with goto – Solution
This month’s C programming Exercise is probably the most bizarre one I’ve ever offered! Using the goto keyword is frowned upon, which means that your C programmer brain is unaccustomed to thinking about using goto to construct, well, anything!
Continue reading
Heron’s Formula – Solution
The challenge for this month’s Exercise is to code Heron’s Formula. This geometric magic calculates the area of a triangle given the length of each of its three sides.
Continue reading