Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Category Archives: Exercise

Post navigation

← Older posts
Newer posts →

The Leap Year Function

Posted on June 1, 2018 by dgookin
Reply

My brain’s algorithm for determining whether the current year is a leap year is based on US Presidential elections. They always happen on a leap year. Or do they?
Continue reading →

Posted in Exercise | Leave a reply

Translating a Timestamp

Posted on May 1, 2018 by dgookin
Reply

A timestamp is one of those tricky chunks of data that’s not really a single value. Often it’s a clutch of integers or — worse — it’s a string. To do time calculations on the timestamp, you must translate it into a more useful form.
Continue reading →

Posted in Exercise | Leave a reply

Highlight a Chunk of Text

Posted on April 1, 2018 by dgookin
Reply

Most of the common data formats, such as CSV, XML, and JSON, use plain text to store complex data or somehow interpret that plain text as something it’s not. The programmer’s job is to translate the plain text and generate the proper type of complex data.
Continue reading →

Posted in Exercise | Leave a reply

Increasing Brightness

Posted on March 1, 2018 by dgookin
6

Recently, I did some graphics programming. The task I gave myself was to highlight a JPEG by drawing a box around an interesting part of the image. The puzzle was which color to make the box so that it would stand out.
Continue reading →

Posted in Exercise | 6 Replies

Oscillation

Posted on February 1, 2018 by dgookin
2

Going back and forth happens frequently in the real world, and not just when you forget to pick up something at the store. Pendulums swing back and forth. The tide rises and falls. Politicians waffle.
Continue reading →

Posted in Exercise | 2 Replies

Swapping Strings

Posted on January 1, 2018 by dgookin
6

Last month’s Exercise was rather silly: Rarely do you need to swap elements between two integer arrays. As Chris pointed out in the Exercise’s comments, “Would it not be easier to just use the array which contains the values you need?” Indeed, it is, which leads up to this month’s Exercise.
Continue reading →

Posted in Exercise | 6 Replies

Swapping Arrays

Posted on December 1, 2017 by dgookin
2

I’m amazed, and a bit envious, when I look at other programming languages to discover a rich variety of functions, or “methods,” that do specific tasks the C language lacks. One of these tasks deals with arrays.
Continue reading →

Posted in Exercise | 2 Replies

Filename Extractor

Posted on November 1, 2017 by dgookin
Reply

Last month’s Exercise demonstrated a filename-extractor, but it cheated: The filename was always the same: same text, same length. That’s not always the case in the real world.
Continue reading →

Posted in Exercise | Leave a reply

Right String

Posted on October 1, 2017 by dgookin
Reply

A recent web page programming puzzle reminded me of an old BASIC language function, RIGHT$. The “right-string” function returns the rightmost n characters from a string. Such a function would have helped me greatly in my web page programming task.
Continue reading →

Posted in Exercise | Leave a reply

The URL Decoding Filter

Posted on September 1, 2017 by dgookin
Reply

Last month’s Exercise was to write a filter that converts ASCII text into a percent-encoded format. This month, you’re task is to reverse the process: White a filter that converts a percent-encoded string back into the original ASCII.
Continue reading →

Posted in Exercise | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Tagging a Union
  • The Clock Angle Problem – Solution
  • The Scary Part of the Union
  • The Clock Angle Problem
  • Back When Unions Were Useful

Recent Comments

  • dgookin on The Clock Angle Problem – Solution
  • Chris Webb on The Clock Angle Problem – Solution
  • Chris Webb on The Clock Angle Problem – Solution
  • dgookin on The Clock Angle Problem
  • Chris Webb on The Clock Angle Problem

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress