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: Solution

Post navigation

← Older posts
Newer posts →

Filename Extractor – Solution

Posted on November 8, 2017 by dgookin
4

When I see a problem such as finding a filename in a pathname, one of the first things I think of are regular expressions. For this month’s Exercise, however, that’s not the solution I coded.
Continue reading →

Posted in Solution | 4 Replies

Right String – Solution

Posted on October 8, 2017 by dgookin
Reply

For this month’s Exercise, I offer both a string function solution as well as a solution that uses pointers. As you can guess, I thought of the string method first, which is where most programmers would run to avoid the dratted topic of pointers.
Continue reading →

Posted in Solution | Leave a reply

The URL Decoding Filter – Solution

Posted on September 8, 2017 by dgookin
Reply

Unwinding percent-encoding involves three steps:

  1. Pass-through the unchanged characters.
  2. Change + back into a space.
  3. Decode the percent strings, which is the most involved process.

Continue reading →

Posted in Solution | Leave a reply

The URL Encoding Filter – Solution

Posted on August 8, 2017 by dgookin
Reply

A URL filter isn’t that difficult to code, once you know the rules. I’m sure you can concoct something clever or obfuscated in the C language, but I chose to use a clutch of if/else if/else statements to process input and generate output.
Continue reading →

Posted in Solution | Leave a reply

Change Due – Solution

Posted on July 8, 2017 by dgookin
Reply

I confess, the solution to this month’s Exercise was frustrating. Several times, I thought to abandon the premise and focus on the main problem, which is how to create a random price, such as $5.32, without that floating-point value really being 5.3187321.
Continue reading →

Posted in Solution | Leave a reply

The Perfect Shuffle – Solution

Posted on June 8, 2017 by dgookin
Reply

A perfect shuffle splits a deck of cards in two. The second half is folded evenly into the first half, so that every other card comes from the first and last half of the deck, respectively. This type of shuffle is practically impossible in real life, but for a computer simulation it’s not that difficult.
Continue reading →

Posted in Solution | Leave a reply

Day-of-the-Year Calculation – Solution

Posted on May 8, 2017 by dgookin
Reply

The solution for this month’s Exercise involves two steps. The first is to generate a random value from 1 to 365 (inclusive) as a day-of-the-year value. The second is to determine upon which month and day that value falls. That part may offer more difficulty than you anticipate.
Continue reading →

Posted in Solution | Leave a reply

Calculating the Date of Easter – Solution

Posted on April 8, 2017 by dgookin
Reply

Easter occurs later this month, on the 16th. You can discover that date by using Google or by running the code solution for this month’s Exercise.
Continue reading →

Posted in Solution | Leave a reply

Detailed Examination of a CSV File – Solution

Posted on March 8, 2017 by dgookin
Reply

The task for this month’s Exercise is to read a CSV file, store the data, then manipulate and report. For my solution, I chose to create an array of structures in which to store the weather information.
Continue reading →

Posted in Solution | Leave a reply

The CSV File – Solution

Posted on February 8, 2017 by dgookin
Reply

This month’s Exercise, required you to read a CSV file, extract specific information, and output a table. It’s basically a file-reading exercise, though you must also translate the input into the proper value. And you must output the month as a string.
Continue reading →

Posted in Solution | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • C Blog 13th Anniversary
  • Colorful Data Chunks
  • A Little Bit Off the Sides – Solution
  • Working with Data Chunks
  • A Little Bit Off the Sides

Recent Comments

  • dgookin on C Blog 13th Anniversary
  • M.Stumpfl on C Blog 13th Anniversary
  • Chris Webb on C Blog 13th Anniversary
  • M.Stumpfl on A Little Bit Off the Sides – Solution
  • dgookin on A Little Bit Off the Sides – Solution

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress