



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




There are 5 pages to this handout
Before you begin, get all the files that you’ll need for this assignment:
mkdir 231 cd 231
cp ~ido715/231/pa1.tar.
tar files are archives, similar to Windows’s zip files. Here’s how to extract the contents of a tar file:
tar xf pa1.tar
The directory PA1/part1/ contains two files: reverse.cpp and Makefile.
make
at the command prompt. This will generate an executable called reverse. You can run the executable by typing
./reverse
Examine the code and try to figure out exactly what the problem is. When you do, modify the program to correct the mistake. Insert comments that explain your modification. When you are satisfied with your answer, type
make clean
This will clear up the directory from files that you won’t need any longer, namely the object and executable files that were generated. Part 1 is now ready for submission.
Files
The directory PA1/part2/ contains the following files:
The directory PA2/part2/ contains a sample executable, std exe.out that you can try out to see how your program is expected to behave for various inputs. The directory PA2/part2/tests contains a number of test cases that you can use to test your program. These are the test cases that will be used for grading. You will receive full credit if your code passes the test cases, is well-designed and sufficiently commented (see commenting guidelines below). In order to test your program using test case X, type:
make testX
This will run the test case, save the result in file test.X.output and compare it to the expected output in test.X.std. If they match, you will see nothing. If they do not match, you will see a list of differences between the two files.
As before, typing make clean will remove your executable (but not the official one), the object file and any coredump files that may be generated.
Write your reservations program in the provided file reservations.cpp. Test it and make sure it is well commented and readable (e.g. uses good variable names and is indented properly).
Move up to directory PA1/ and type
tcsh submit
to run the submission script. You may resubmit your assignment as many times as you need.
Even though the reservations program is not difficult, it is your first C++ program. This means that you’ll make many mistakes in the beginning. The program will take you longer to complete than you may think, so START EARLY!. When you get stuck, get help. Don’t spend hours trying to figure out what an error message means or why your program is giving unusual output. Post to the newsgroup or email me. The newsgroup is a better option since it will be monitored by both me and your classmates and you may get an answer faster than if you just emailed me. Just remember to never post your code (there’s only one exception, described below). If you are getting compilation errors, post the exact error message that the compiler gives you (copy and paste it). You may also post the one line of code where the error occurs. As you know, I have no set office hours. This means that you can come by my office at any time. If you want to call in advance to find out whether I’m in, the number is 491-5708.
These guidelines should be followed throughout the quarter. For this assignment, you only need file headers and inline comments: