The function body should check to see if nbrleftinbox is 0. If it is, return true; otherwise, return false. You should not declare nbrleftinbox; it is declared in letters.h.
The function header looks similar to the function prototypes, but there are a few details to discuss.
char board::at(int row, int col) const
{
if ((row > DOWN) || (col > ACROSS))
{
return OUT_OF_BOUNDS;
}
return contents[row][col];
}
Don't worry too much about how the function is accomplished; just look
at the header. Notice the board:: before the function name
at.
You will need to put the name of the class (letterbox)
and the scope resolution operator (::) before
your function name (done) as well.
This tells the compiler that this function is the function definition
for the done prototyped in letters.h.I have put the file board.cc in my Public directory so you can view the source code. board.o is board.cc compiled (using the command g++ -c board.cc). Remember the "-c" tells the compiler to compile only, not to link. The compile only step makes an object file, but not an executable file because, among other reasons, there is no main function, so you would receive an error if you tried to compile board.cc into an executable file. If you are having trouble with the function header for done, look at board.h and the prototype for at, and board.cc with the function definition for at to try to figure out how to do done. Otherwise, unless you're interested in the source code for board.cc, just ignore it. You do not need it for this project.
The make command will automatically do the compilation for you. If you want to recreate your game file and your done.o file, type make clean
If you want to use the board with darker colors, substitute board2.o for board.o in your
You will receive a maximum of a 50 for a program that has syntax errors. You will receive a maximum of 75 for a program that compiles, but does not execute correctly. You will receive a maximum of 87 for a program that runs correctly, but does not have a comment indicating how you tested the true and false cases for done. Additional points off will come from not following the program style guide, and from other errors.
You should submit this program with the command
/home/lambert/cpsc230/handin230 2 2
because this is the second part of the second assignment that you are turning in using the handin program. (Refer to submission web page.)