|
CS 371
|
Due by BEGINNING OF CLASS on 2/14/05
Point3Df projection(Point3Df &v)This method, when invoked with u.projection(v), should compute the vector which is the projection of the vector v onto the vector u.
/home/faculty/lenhart/shared/cs371Fall02/sampleCode,
vector op vector,
As far as error-catching is concerned, you should catch illegal operators, as well as handle special cases of the projection method. If you use the overloaded >> method to read the vectors (as Point3Df objects), you don't have much control over a badly formatted vector. If that bothers you, you can parse the vectors yourself to get better error-handling of input.
This is a short assignment the goals of which are to give you experience writing simple C++ code, to get you comfortable with the Unix environment, and to get you to start working!
To compile the class Point3Df, enter the Point3Df directory and type:
g++ -c Point3Df.cc
g++ -c Calc.cc
However, these commands only check for internal consistency during compilation. To create an executable program Calc that uses your Calc.o and Point3Df object code, type:
g++ -o Calc Calc.o Point3Df.o
Calc, or, depending on your system, ./Calc
g++ -g -c Calc.cc, or g++ -g -o Calc Calc.o Point3Df.o
Note: A General Principle: A user should never need to read your source code to know how to use your program!
There will be a "turn-in" directory available into which you can drop your work. To turn in your work, create a directory containing all of the files mentioned above. Call your directory LastnameCalc (eg: StewartCalc). From the directory containing LastnameCalc, type
tar cvf LastnameCalc.tar LastnameCalc
(replacing "Lastname" with your own last name!) to create a single "tar" file. Then drop the tar file off in the drop-off directory, by running the program
/usr/cs-local/bin/turnin LastnameCalc.tar.
The first time you use it, you will be asked if you want a directory created for your turned-in files. Say "yes".