I’ve not installed Code::Blocks on a Linux computer, but for a moment I’ll pretend that such an installation has the same issue I described in last week’s Lesson: You must manually link in the C language math library to create any program that uses a math.h function.
Continue reading
Author Archives: dgookin
The Curse of Typecasting – Solution
I hope you didn’t find this month’s Exercise too daunting. In fact, it’s pretty basic stuff, but often something you might forget. In fact, the compiler may remind you when you attempt to pass an argument to a function and it’s of the wrong type.
Continue reading
Link in the Math Library
Recently, I had question posed to from a reader from Norway. He was working his way through my book and found that one of the programs wouldn’t compile on his Linux computer. The problem was that the C language math library isn’t automatically linked. The effect is that a linker error appears upon compiling.
Continue reading
The Curse of Typecasting
In the C language, it’s called typecasting: A variable of one type — for an instant — masquerades as another variable type. In Hollywood, however, it’s a curse: The typecast actor can play roles other than the one he’s famous for creating. That sucks.
Continue reading
Fuzzy Matching, Now With Forgiveness
Even when you add fudge to a matching system, occasionally that odd bit of data — the outlier — can wreck an otherwise close match. The question is, how many of those mismatches does your code allow?
Continue reading
Fuzzy Matching with Percentage Variation
A fuzzy match that uses discrete amount of fudge might not yield a match, especially when the values cover a wide range. To better make the match work, set a percentage variation instead.
Continue reading
Fuzzy Matching Tolerance
Comparing values is a discrete process; an if comparison is absolute. The result is either true or false. Never is the result perhaps or somewhat — unless you add some fudge to the comparison.
Continue reading
Take Your Turn – Solution
This month’s Exercise is to simulate turns in a game of tic-tac-toe (naughts and crosses). So the solution requires that you randomly work through available squares in the game matrix, alternating placement of an 'x' or 'o' token.
Continue reading
Non-Identical Yet Very Similar
Computer’s are notoriously obedient and serious. They’re exact. If you give them inaccurate instructions or bad data, the computer does its job without question. But the real world isn’t binary and often times it’s necessary to add some forgiveness into your code.
Continue reading
Take Your Turn
The game of Tic-Tac-Toe, also called Noughts and Crosses, provides a fertile field to plow for any budding programmer. It involves a matrix (array), logic, decisions, and all sorts of fun. If you haven’t yet coded your own Tic-Tac-Toe game, I urge you to do so, but that’s not the topic for this month’s Exercise.
Continue reading