CS 162 Fall 2001                                Assignment 5 –Using the string library (and using an existing class)                      100 points

 

Assigned: 10/08/2001

Due: 10/15/2001 at the start of class.

Pre-Lab (Do Before Lab): Bring an empty (or nearly empty) disk. Plan out steps needed for program.

Pairs: You may work in pairs if you want. Note, during the course of the semester, you cannot pair with any one person more than twice. If you work in a pair, turn in ONE copy that is the work of both of you, with both of your names on it.  Each member of the pair will receive the same grade for that lab.  In such a partnership, students must share as equally as possible the work and learning.  Working together with truly shared effort and learning can be a positive experience. However, simply giving/receiving code from someone defeats the learning process. If substantial parts of a program are taken from non-partners, that is plagiarism. The copier and copyee will each receive a zero.

Main Assignment:

                This program is a “Find A Word” puzzle program. A WordMatrix class has been provided (WordMatrix.h and WordMatrix.cpp under Review on my WWW page). Create a client program, as illustrated below. The program should create a word matrix (default constructor), then search for each of the search words in rows and columns (forward and backword). The program should report where the beginning of the word is found and which direction the word goes (see below). There is no real user input. Extra credit (20 points) if you can find diagonal words too (this is significantly harder).

Details:

1)       If you change WordMatrix.h and/or WordMatrix.cpp,  make sure you hand them in as well. (I don’t think you should have to – I don’t think you should even have to look at WordMatrix.cpp)

2)       The non-default constructor is not available at this time.

Hand-in:

    1) Listing of the program

 2) Disk with your .cpp file and your working .exe file. NAME YOUR PROGRAM FILE yourlastname5.cpp; Name your project yourlastname5 so that the executable will be yourlastname5.exe. If you are working in pairs, use both last names (e.g. redmondsmith5.cpp)

Miscellaneous:

1) If you have any questions about what should be done, please ask!!

2) MAKE SURE YOUR PROGRAM WORKS! (i.e. more than just removing compile errors). By the time you are done, I may have the capability to create other word matrices besides the default one. Ask if I have updates and test again if I do. 

3) You should have at least one function besides main in your work.

4)       Remember: Indentation, meaningful variable names, symbolic constants, and meaningful comments. Weaknesses in any of these could result in points off. Also make sure you put YOUR NAME(s), section, and e-mail address in comments at the beginning of the program.

Sample Interaction:

Word Matrix:

L L A B T E K S A B

A U G N I L C Y C W

C H G S O C C E R H

S R D E Y R B C B A

Y N I B O O O C S N

B E G C W Q L O I D

F U K L K U O B N B

R L I C I E P F N A

U N O G O T T M E L

G A T G R H P E T L

 

Search Words:

BASKETBALL  LUGE  SOCCER  HANDBALL  CROQUET  BOCCE  HOCKEY  RUGBY  BOWLING  CYCLING  CRICKET  POLO  TENNIS  GOLF 

 

Searching for: BASKETBALL

Found word: BASKETBALL in row 1 and column 10 and toward the left!

Searching for: LUGE

Found word: LUGE in row 1 and column 1 and to the bottom right

Searching for: SOCCER

Found word: SOCCER in row 3 and column 4 and to the right

Searching for: HANDBALL

Found word: HANDBALL in column 10 and row 3 and toward the bottom

Searching for: CROQUET

Found word: CROQUET in column 6 and row 3 and toward the bottom

Searching for: BOCCE

Found word: BOCCE in column 8 and row 7 and toward the top!

Searching for: HOCKEY

Found word: HOCKEY in row 10 and column 6 and toward the top left!

Searching for: RUGBY

Found word: RUGBY in row 8 and column 1 and toward the top right!

Searching for: BOWLING

Found word: BOWLING in row 4 and column 7 and to the bottom left

Searching for: CYCLING

Found word: CYCLING in row 2 and column 9 and toward the left!

Searching for: CRICKET

Found word: CRICKET in row 3 and column 1 and to the bottom right

Searching for: POLO

Found word: POLO in column 7 and row 8 and toward the top!

Searching for: TENNIS

Found word: TENNIS in column 9 and row 10 and toward the top!

Searching for: GOLF

Found word: GOLF in row 10 and column 4 and toward the top left!