d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C++ Crossword Puzzle > Help
Add Reply New Topic New Poll
Member
Posts: 2,081
Joined: Jan 13 2007
Gold: 515.76
Feb 27 2013 12:25pm
Any help is welcome, there is a .zip file as well
if anyone thinks they know how to do this let me know
thanks


You will complete a C++ program that allows the user to solve a crossword puzzle. Some words must be filled in horizontally (“across”), some vertically (“down”). For each word, there is a short clue. In this program, the crossword puzzle is represented by a class that currently contains a static 2-dimensional array. You will change it to use a dynamic 2-D array.

The class CrosswordPuzzle represents a crossword puzzle and contains a 2-D array o
char (board) to store blocked out, filled-in, or empty positions. It also holds several 1- arrays
(of various data types) to store information on the words to be filled in.

The crossword puzzle is loaded from a file [using load()]. First, the size of the board (rows,
columns) is read. The 2-D array is then blocked out (made to store all '#') based on those
dimensions. Next, the words and clues are loaded from the file. While loading data on words,
positions that will hold words are made empty (store ' ').

Dynamic Arrays

Information on words to be filled in is stored in multiple dynamically-allocated 1-D arrays. All
are treated as parallel array. For example, index 0 in the “across” arrays keeps information about
the first “across” word. In the default puzzle, there are 4 “across” words, with the number of
words stored in numAcross once loaded:


Strings
Each word or clue is stored as a string (an element in an array). Recall that strings can be compare with relational operators (==, !=, …) and each character in a string can be accessed using a zero-based index. For example, to access the first character of the second word (acrossWords[1]) above, you could write acrossWords[1][0] (zero being the index of the first character). You can determine the number of character in a string by calling its length member function, e.g.: acrossWords[1].length().
Your task is to make the following changes or additions to the class that represents a crossword puzzle:
 Wrap the header file of the CrosswordPuzzle class with #ifndef…#endif to prevent the errors that would occur if the header was included multiple times.
 Change the static 2-D array into a dynamic 2-D array. This involves changing the type of data member board. Initialize this revised data member in the constructor.
 Dynamically-allocate the 2-D array in member function load() once its size is known, i.e., once its dimensions are read from the file.
 Add a destructor that deallocates all dynamic arrays: the original 1-D arrays provided and the dynamic 2-D array you added. Remember to reset the pointers and related data members.


Define member function enterWord (declaration and partial definition provided), which allows the user to fill in either an “across” or “down” word. Code to find the index where the word at the labeled (number) passed is stored in the 1-D arrays is already provided for the “across” words. Thus, you must:
1. Display an error message if there is no word at the label (number) passed. E.g., suppose the user tries to fill in 2 across. This should generate an error message since there is no such word, only 2 down.
2. Check that the word will fit in the space provided at the specified position. If not, display an error message.
3. Place the word in the puzzle, by storing its letters in the 2-D array (board). You may overwrite letters already stored.
4. Go through a similar procedure if the parameters specify a down word.
Again, do not check whether the word is correct, only that it fits at the specified position.
Choices you make may impact your grade. Avoid unnecessarily complex solutions. You may add private helper member functions to the class if desired. However, do not alter how any of the other existing member functions work.
Main Program
The main program declares a CrosswordPuzzle object and then calls appropriate member functions to load the puzzle and to allow the user to fill in words and to check for completion. No additional code is needed in the main program; however, complete the documentation at the top.
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Feb 27 2013 12:39pm
I could do this, doesn't seem too difficult. Are you looking for help or wanting to pay someone to do it for you?
Member
Posts: 51
Joined: Feb 7 2013
Gold: 0.00
Mar 12 2013 05:42pm
warning mcfighter don't trust selftaught to help you on anything, Suggested you wait until someone more reliable can help you
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Mar 13 2013 12:45am
Quote (Xarai @ Mar 12 2013 07:42pm)
warning mcfighter don't trust selftaught to help you on anything, Suggested you wait until someone more reliable can help you


just crying because you want us to do all the work for you. we tell you how to solve your problems when your posts are not garbage and actually semi intellectual but you still dismiss it and want someone to do it for you.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll