Hexadecimal, or counting base 16, uses letters A through F to represent values 11 through 15. This base — “hex” — is common in programming as it works as a shorthand for binary values. But the letters used are also letters, which means that they can spell words.
Continue reading
Author Archives: dgookin
Ethiopian Multiplication – Solution
The challenge for this month’s Exercise is to write code that uses the Ethiopian Multiplication method. The process involves doubling and halving the factors, then eliminating and finally tallying the result.
Continue reading
Testing For the random() Function
Silly me. I once assumed that just because my compiler offered the random() function — a superior version of the C library standard rand() function — that every compiler fatured this function. Boy, was I wrong!
Continue reading
Ethiopian Multiplication
Difficulty: ★ ★ ☆ ☆
I remember memorizing the “times tables,” which is how most American kids learn to multiply. Committing single digit multiplication values to memory helps perform multiplication and division problems, but it’s not the only way to calculate the result.
Continue reading
Seeing What’s Left Over with Division
Learning division in school means long division. The process involves a quotient and a remainder. For example, 42÷8 works out to 5 (quotient) with 2 remainder. On a computer, however, division renders the result as 5.25. So how do you get the remainder separated?
Continue reading
The Second K&R Program (That No One Talks About)
The original K&R, the first C programming book — and truly the programming book all others are based upon, is famous for its “Hello, world!” program. It’s the first program in the book. But what about the second program? Do you know what it is?
Continue reading
More Terminal Screen Manipulation
Bouncing a cursor on the screen is a fun programming exercise, and you can use common C library techniques and ANSI escape sequences to make it happen in a terminal window, as covered in last week’s Lesson. At this point, most programmers would be content and leave well enough alone. Not me!
Continue reading
Multiplying Matrixes – Solution
My solution for this month’s Exercise relies upon the solution from last month’s Exercise, specifically the way the matrixes are presented in the main() function and the use of the output() function. What I added is the multiply() function, which multiplies the two matrixes.
Continue reading
Bouncing an Asterisk
For last week’s Lesson, I gathered various techniques to show how the terminal screen can be manipulated directly in C without using a library like Ncurses. I have a few more tricks to show.
Continue reading
Multiplying Matrixes
Difficulty: ★ ★ ★ ☆
The task for last month’s Exercise was to describe complex data — a matrix. For this month’s Exercise, your task is to multiply these matrixes.
Continue reading