It’s not the first thing you think of when you design output. No, it’s one of those afterthoughts, those numerous, “Hey, I could do this” moments that programmers experience time and again. In this case, the concept is centering a chunk of text.
Continue reading
Category Archives: Exercise
Numbers With Commas
As a programmer, you’re used to seeing values like 1000 or 1234999. Your users aren’t. They prefer to see values presented as 1,000 or 1,234,999.01. Or, in Europe the format may look like this 1.000 or 1.234.999,01.
Continue reading
Test Your Formatting Knowledge
In late September and early October, I wrote a series of lessons on how the various printf() formatting commands are used. Now it’s time to put your skills to the test.
Continue reading
Allow Me to Squeeze In Here…
When it comes to editing text, the concept of copy and paste is an old one: You select a chunk of text, choose its new location, then paste in the text. The surrounding text jiggles around to make room. Neat and tidy.
Continue reading
Min and Max
The C language is rather weak when it comes to array functions. In fact, as far as I know, the standard library doesn’t contain a single array function.
Continue reading
The Caesarian Cipher
A Caesarian Cipher is one of the simplest, weakest forms of encryption. Supposedly developed by Julius Caesar, it’s a letter substitution cipher: A becomes C, B becomes D, C becomes E, and so on.
Continue reading
We Have a Winnah!
The game of Tic-Tac-Toe is played on a simple 3-by-3 grid, what C programmers would call a matrix. It’s not The Matrix, of course, but it’s a simple array in which players can battle.
Continue reading
1st, 2nd, and 3th
For your June exercise, you need to concoct code that properly generates an ordinal number. Write a function that returns a string “st” “nd” “rd” or “th” that’s tacked on to any integer value from 1 through what-have-you.
Continue reading
Word Swapping
For your May challenge, write code that takes a two word sentence and displays the words in reverse order. For example, take the string Swap me and have the program spit out the text me Swap.
Continue reading