Difficulty: ★ ☆ ☆ ☆
If you’ve studied the terminal window at any length, you probably know about the clear command, which clears the screen. Under MS-DOS, and on my old TRS-80, the command is cls. Same thing.
Continue reading
If you’ve studied the terminal window at any length, you probably know about the clear command, which clears the screen. Under MS-DOS, and on my old TRS-80, the command is cls. Same thing.
Continue reading
The final (and merciful) update to my Grid of Random Stars program involves two major changes. First, because I call the update_grid() function only once, it can be incorporated into the main() function, no program. Second, I remove pointer notation.
Continue reading
The program may output what I want, but the code isn’t done yet. Continuing from last week’s Lesson, I’d like the program to output a single grid showing a summary of all the rectangles found. This update requires more changes to the existing code.
Continue reading
The two problems I recognized in the code from last week’s Lesson were that scan_column() and find_right() don’t need to be separate functions. Also, the code fails to find all the rectangles in the grid, which is bad. Time to fix the code!
Continue reading
I was so excited with last week’s code that I didn’t bother to confirm that it worked properly. No, I was eager to see graphic output of the found rectangles.
Continue reading
This month’s Exercise is rather simple, though it doesn’t promise a simple solution. Instead, I offer three solutions. One of which is obvious and two are kind of out there. They all work, which is the point.
Continue reading
Adding values is a basic programming concept: 4 + 5 = 9 But where do the values come from? They can be literals, variables, expressions, or values collected from the user.
Continue reading
The next update to my pattern-finding program is to hunt down and find a clutch of asterisks in the grid that form a rectangle. Figure 1 illustrates what I’m after.
Continue reading
To count all possible rectangles in a random grid requires a lot of scanning. My first thought was that the process would involve recursion. I wasn’t 100 percent certain, but I wanted to prep the code for such a possibility.
Continue reading
Ever since I was a little boy and coded my first nested loop, I’ve enjoyed messing with grids in C. I’ve done monthly calendars in grids, rotated grids, manipulated grids mathematically — all sorts of fun girddy stuff. But I’m not done yet.
Continue reading