Often times the problems you’ll encounter in C involve interface with something else. You’ll need to code directions for an operating system or interact with data that already exists or is output from some function. In this month’s exercise, you get to test-run those skills.
Continue reading
Author Archives: dgookin
Roll Your Own String Search Function
How do you search for one string within another string? Brute force! That means, you size up each character one at a time until you find the perfect match.
Continue reading
Search for That String Again
It’s straightforward to use the strstr() and related C library searching functions to locate a string in a pile of text. To locate the next occurrence of that string takes a bit more work.
Continue reading
More String-Searching Functions
The C library is teaming with string-searching functions. The most basic is strstr(), which I discussed in last week’s Lesson. That function has some brothers and sisters.
Continue reading
Finding Text with strstr()
The programming universe is teaming with search algorithms. In fact, searching for stuff has become so commonplace computer users casually take it for granted. Things weren’t always that way, but the programming algorithms behind the search remains the same.
Continue reading
Number Crunching
Forget the graphics. Forget the fancy stuff, which amazingly includes text. At the root of all programming, and the foundations upon which modern computer science is erected, lies the ability to quickly and accurately calculate vast seas of numbers. The traditional title for this activity is Number Crunching.
Continue reading
Show Me a Bar Chart
Computers are notorious for spewing out rows and columns of meaningless numbers. Sure, they have significance, but often your audience is more energized when they view something other than a dull table filled with values.
Continue reading
Plotting a Circle
Circles are easy to draw by hand, especially when you have a compass. On a computer, the Circle tool is common in graphics programs, although it’s really the Ellipse tool. And when programming, well, you’ll have to plot your own circle — especially when pulling a stunt like drawing graphics in text mode.
Continue reading
Graphing Curves in Text Mode
When it comes to plotting curves in the C language, you need to dust off your trigonometry. It’s not a scary thing: The C library offers a host of mathematical functions, many of which can help you plot a curve here or there. In fact, writing a function to draw a curve is a lot easier than plotting a straight line.
Continue reading
Graphing in Text Mode, Part III: Better Lines
After you create a point-plotting function, the next obvious graphical function to code is the line. Whether you’re graphing in text mode or using pixels, you’ll quickly find that two conditions exist where a line function just can’t draw a line.
Continue reading