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 →

Find the Duplicates – Solution

Posted on March 8, 2019 by dgookin
3

I devised two solutions for this month’s Exercise. The basic solution can be solved in two steps, with a more involved solution using three.
Continue reading →

Posted in Solution | 3 Replies

The Wandering King – Solution

Posted on February 8, 2019 by dgookin
2

This month’s Exercise was inspired by a program I recall from years ago called The Drunk and the Lamppost. It’s not the classic joke, but an examination of random movements and probability.
Continue reading →

Posted in Solution | 2 Replies

Fizz Buzz – Solution

Posted on January 8, 2019 by dgookin
Reply

The nifty thing about this month’s Exercise is that so many solutions are available. In fact, I found the challenge engaging because I kept trying to think of other ways to solve the puzzle.
Continue reading →

Posted in Solution | Leave a reply

The Whole Month from a Single Day – Solution

Posted on December 8, 2018 by dgookin
Reply

The key to creating a calendar is to know on which day of the week the first of the month falls. This datum can be extrapolated from any other day of the month, as long as you know on which day of the week it falls.
Continue reading →

Posted in Solution | Leave a reply

Counting in Alphabedecimal – Solution

Posted on November 8, 2018 by dgookin
1

Yes, it’s possible to code a program that counts in alphabedecimal from AAAA to ZZZZ without using nested loops. You must use a single loop, of course, but no cheating as shown in the original Exercise post.
Continue reading →

Posted in Solution | 1 Reply

Initial Caps – Solution

Posted on October 8, 2018 by dgookin
2

The solution for this month’s Exercise is perhaps a bit trickier than you may have anticipated. The issue is to set the first letter of a word as upper case and the remaining letters lowercase. The solution I devised involves reading two characters at a time.
Continue reading →

Posted in Solution | 2 Replies

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

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