Back in the day, computer programming courses offered predictable assignments. These were number-crunching exercises, which had little flash and, yes, were boring. Today you can plot graphics, manipulate sound, and explore the web with your code. Back then, you’d do something dull like calculate depreciation.
Continue reading
Category Archives: Exercise
Text Parsing Power
Parsing is an activity that programmers are often reluctant to do themselves. That’s because parsing can be a real pain in the rump. Not only that, but why write your own function when you can use specific libraries that handle the job for you? That’s a blessing, but it won’t let you escape from attempting this month’s Exercise.
Continue reading
Defensive Input
The task is rather simple: Prompt the user to input a value between 1 and 9. If you’ve read the first few chapters of any of my For Dummies C programming books, you could do that one easily. But what happens when the user doesn’t type a value in that range or — worse — they type text instead?
Continue reading
Merry Cumulative Song Exercise
In my C programming books, I often use the directions on a shampoo bottle as an example of basic programming:
1. Lather.
2. Rinse.
3. Repeat.
Another real-life example of programming techniques happens in music. Specifically, cumulative songs are representative of loops. This type of song includes 99 Bottles of Beer and the holiday favorite, The Twelve Days of Christmas.
Continue reading
Hex Parsing
Parsing is the process of sifting through a chunk of data to look for significant information. It’s a big topic.
Continue reading
The Hailstone Sequence
The Hailstone sequence is based on the theory is that you can perform a specific calculation on any positive integer to create a series of numbers. No matter which positive integer you start with, eventually the sequence ends with the value 1.
Continue reading
Flip That Bit
All the nonsense that takes place in programming happens because it’s possible to change the value of a bit from 0 to 1 and back again. The general concept is known as a toggle switch: The item can be set and reset between on and off positions.
Continue reading
Plotting Squares
The term sounds terrifying, but it doesn’t need to be: Data analysis is the process of using code to examine data and come up with some sort of conclusion. Obviously it helps to know the type of conclusion before you write the code. Only in science fiction does someone say, “What do you make all of those seemingly boring numbers, Mr. Computer?”
Continue reading
Spelling Alphabet
The spelling alphabet is a tool used by the military, police, and other professionals. It helps them to sound cool when they spell names. You’ve probably attempted to spell that way yourself, even if you didn’t know any official spelling alphabet. Lots of people say, “N as in Nancy.” That’s how the spelling alphabet works.
Continue reading
Let’s Go Bowling – An Entire Game!
In last month’s Exercise, the assignment was to craft a single frame in a game of bowling. This time, you need to stitch together 10 frames to simulate bowling an entire game.
Continue reading