Assignment 3 FAQ and Student Discussion Page
The course staff will post answers to frequently asked questions about assignment 3 here. Feel free to add to this page yourself if you've got information to share with the rest of the class. Remember, the quickest way to get a response from a TA is to post to firstname.lastname@example.org
Return to the Assignment 3 page.
Comment: VS Express Linkage Problems
If you are using Visual Studio Express 2005 and obtain linkage warnings involing libST functions that look like this:
Linking... layout.obj : error LNK2019: unresolved external symbol "public: class STSceneNode * __thiscall STSceneNode::GetNext(void)" (?GetNext@STSceneNode@@QAEPAV1@XZ) referenced in function "void __cdecl destroyDrawables(class STSceneNode *)" (?destroyDrawables@@YAXPAVSTSceneNode@@@Z) layout.obj : error LNK2019: unresolved external symbol "public: class STSceneNode * __thiscall STSceneNode::GetFirstChild(void)" (?GetFirstChild@STSceneNode@@QAEPAV1@XZ) referenced in function "void __cdecl destroyDrawables(class STSceneNode *)"
It's probably because VS Express hasn't correctly loaded the libst library dependencies from our project/scolution files (all this works fine in the full blown version of Visual Studio). You'll need add libst.lib as an additional dependency in your assignment3 project.
Go into the project properties > Linker > Input and adding libst.lib to the list of 'Additional dependencies'.
(thanks to Paolo Bezoari for reporting this)
Comment: Control characters under Unix/Mac
If you're developing on a non-Windows machine and see control characters (empty boxes) in your output, make sure to remove the carriage return character ('\r') when you read from the text file. Under Windows, opening files in text mode should deal with this automatically, but other OSs won't.
Question: Since the file alice.txt starts with a blank line it has a title of 0 length correct?
'alice.txt' should have a title.
- We'd like you to treat the text from the beginning of the first non whitespace character of the file to the first
paragraph break as the first paragraph. A paragraph break is designated by *at least* one line containing only whitespace in between two paragraphs. Whitespace lines, followed by a bunch of text, following by a bunch of blank lines, followed by a bunch of text, would constitute two paragraphs.
Question: Do we have to deal with the case in which one word exceeds the column width? Or can we put at least one word per column?
Yes, you can assume at least one word per column. Otherwise we would have to also require you to hyphenate words. We ignore hyphenation in this assignment.
Question: the requirements say that the default spacing between words should be X/4 but no less than X/5. Is there a maximum spacing between words?
In this assignment there is not, and we realize a line with a few big words that is full justified might have a significant amount of space between words. You should put as many words on a line as you can without violated the two stated constraints.
Note that professional quality typesetting algorithms have a large number of heuristics built into them to avoid large spaces between words. Hyphenation goes a long way toward preventing long spaces.
FYI, For best results, typographers recommend that the maximum spacing be M/2. That usually looks good.
Question: Are we allowed to use other ADTs? Specifically, I want to use the vector class (given out in CS106a) to store my words rather than defining a struct and re-writing the same code. Also classes like Scanner (basically strtok with a wrapper) would come in handy. Can I use these?
Yes, we permit you to use CS106a classes or containers provided by C++ STL provided that:
You make it easy for us to run and grade the code on either Windows or on Linux. In your zip file handin, please provide a modified version of /assignment3/Makefile or /assignment3/layout_vs2005.vcproj (or the 2003 version if that's what you're using) along with all the files in your project.
Question: When you say "The default (preferred) word spacing should be 1/4 the font size," I'm assuming this is only for left-aligned text (i.e. the last line of each paragraph)? It seems that for a line of justified text with n words, the spacing is dependent on the number of words in the line and their total width.
Yes, that is the correct interpretation.
Question: When you say "No two words can be spaced CLOSER than 1/5 the font size", do you mean "the minimum PIXEL separation is 1/5th the font POINT size"? Which units are pixels and which are points?
If a font is X points. The minimum word seperation should be X/5 points, and the "preferred" or so-called natural spacing for left-aligned text is X/4 points.
The conversation to pixels is pretty straightforward, considering you should interpret the display as a 72 DPI device, and one point is 1/72th of an inch.