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 →

Shuffle That Playlist – Solution

Posted on September 8, 2018 by dgookin
Reply

The solution to this month’s Exercise is similar to code I’ve presented in my books and in this blog with regards to randomly drawing from a fixed set of elements. Yet it has an extra level of complexity.
Continue reading →

Posted in Solution | Leave a reply

Duplicated Letters – Solution

Posted on August 8, 2018 by dgookin
Reply

The challenge for this month’s Exercise is to write code that counts repeating letters in a string. For example, the string “Hello, this is a test” repeats the letters T and S three times, letters E, H, I, and L twice, and the letters A and O appear only once.
Continue reading →

Posted in Solution | Leave a reply

Fill My Grid – Solution

Posted on July 8, 2018 by dgookin
2

The puzzle for this month’s Exercise was to create and fill a 20-by-20 character grid with 20 asterisks placed at random positions, no two asterisks in the same spot. I hope you found this Exercise interesting, but not too easy.
Continue reading →

Posted in Solution | 2 Replies

The Leap Year Function – Solution

Posted on June 8, 2018 by dgookin
Reply

I’ve tackled the leap year program on this blog before. My Month Program series addressed the issue specifically. That code offers the february() function, which returns 28 or 29, depending on whether the current year is the leap year.
Continue reading →

Posted in Solution | Leave a reply

Translating a Timestamp – Solution

Posted on May 8, 2018 by dgookin
3

Your task for this month’s Exercise is to take a timestamp string and move values from inside a string (characters) into a structure. It’s not an easy exercise, and it doesn’t have a single, best solution.
Continue reading →

Posted in Solution | 3 Replies

Highlight a Chunk of Text – Solution

Posted on April 8, 2018 by dgookin
Reply

Your task for this month’s Exercise is to code a text-processing routine that interprets the ^ character as a toggle for all-caps output. This challenge can be difficult, depending on how you interpret the toggle.
Continue reading →

Posted in Solution | Leave a reply

Increasing Brightness – Solution

Posted on March 8, 2018 by dgookin
Reply

The challenge for this month’s Exercise is to fill a cup without overflowing it. That cup is an unsigned char value, which goes only to 255 maximum. If your goal is increase the value of an unsigned char variable by 10 percent, any value over 255 - (255/10), or 220, must be set to 255.
Continue reading →

Posted in Solution | Leave a reply

Oscillation – Solution

Posted on February 8, 2018 by dgookin
5

For my solution to this month’s Oscillation Exercise I created a toggle variable. This variable switches between 1 and -1. It sets the direction for the cascading values.
Continue reading →

Posted in Solution | 5 Replies

Swapping Strings – Solution

Posted on January 8, 2018 by dgookin
Reply

This month’s Exercise involves swapping elements between two string arrays. A number of solutions exist (as always), but because the “strings” are really pointers, the solution can be very specific. Yes, you just might have to use that dratted ** notation. Brace yourselves.
Continue reading →

Posted in Solution | Leave a reply

Swapping Arrays – Solution

Posted on December 8, 2017 by dgookin
2

The two functions required from this month’s Exercise are show_arrays() and swap_arrays(). They’re not that difficult to code, meaning that you don’t need to use the dratted ** notation or perform any special tricks. Here’s how I solved the problem:
Continue reading →

Posted in Solution | 2 Replies

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