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
Playing with the Terminal
I miss the bad old days, back when I first learned to program. The microcomputers of the day were single user, single task. The hardware was directly accessible. You can truly do some messing around, which was quite entertaining for a budding programmer.
Continue reading
The Look-and-Say Sequence
(As Much as the Computer Can)
Coding a Look-and-Say sequence should be fun, just like any C programming project where you’re not under pressure from a deadline. From last week’s Lesson, I was able to create a nested loop that takes a number and outputs its Look-and-Say values. It’s time to update this code to output a sequence.
Continue reading
Coding a Look-and-Say Sequence
You may have seen this sequence on the Internet, in one of those “guess which number goes next?” type of posts:
1 11 21 1211 ...
So, which number comes next? I suppose it’s possible to divine a solution mathematically, but this sequence is known as a Look-and-Say sequence.
Continue reading
Describing Complex Data – Solution
In the C language, a structure is used to express complex data types. The structure contains members that describe different parts of this complex data, such as a matrix required in this month’s Exercise.
Continue reading
Modifying an Array
I’ve seen functions (okay, methods) in other programming languages that let you digitally tussle with an array. You can split an array, trim it, expand it, insert elements, remove elements, and so on. Such things are possible in C, but you must code the function yourself.
Continue reading
Describing Complex Data
Difficulty: ★ ★ ☆ ☆
I’ve written many C programming Lessons and Exercises that deal with matrixes. For most of them, such as rotating a matrix, I rely on uniform matrix sizes, like 5×5 or 10×10. This approach makes coding easier, but it doesn’t properly describe every type of matrix.
Continue reading