Colorado State University

This file defines the header for each page. An optional "icon" image (I use the textbook):

Replace this with info about this class:

CS253: Problem Solving with C++

Spring 2013

HW 2

Links to the various pages for this class:

Wish I could do this: * Schedule

HW2: Word Helper

Description

Write a C++ program called wh.cc that helps you match hangman or crossword-puzzle words.

Your program reads in a dictionary of words. The dictionary used in the sample run is here. It has the concept of a current “guess”, which is of a fixed length. Initially, all letters in the guess are undetermined, but some letters can be determined by the user.

Sample Runs

    % g++ wh.cc
    % ./a.out
    'h' for help
    ? l 5
    _____ has 0 matches.
    ? h
    l <len>: set length
    d <filename>: read a new dictionary
    a <letter> <positions>: add letter to the given positions
    w: show all words that match
    c: clear the guess to all underscores
    h: show this help listing
    q: quit
    _____ has 0 matches.
    ? d common-words.txt
    There are 4342 words.
    _____ has 687 matches.
    ? ae4
    ____e has 150 matches.
    ? a t0
    t___e has 12 matches.
    ? a h 1
    th__e has 5 matches.
    ? w
    these
    those
    theme
    three
    there
    th__e has 5 matches.
    ? ae2
    the_e has 3 matches.
    ? w
    these
    theme
    there
    the_e has 3 matches.
    ? r
    Invalid command!
    the_e has 3 matches.
    ? c
    _____ has 687 matches.
    ? q

Requirements

Dictionary

The guess

The a command

Errors

Miscellaneous

If you have any questions about the requirements, ask. In the real world, your programming tasks will almost always be vague and incompletely specified. Same here.

Turning it in

How to submit your homework:

Follow the instructions on the Homework page

How to receive negative points:

Turn in someone else’s work.
Page: Main.HW2
Modified: February 08, 2013, at 11:51 AM
Wiki: pmwiki-2.2.35
CS Department
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2012 Colorado State University