You may use any C++ compiler to do your work, however the code that you submit must compile and run on CSA with gnu g++. You may access CSA from home if you have a modem or ethernet connection; if not, you may use the CS Lab or the ACS lab in the basement of MCS at 111 Cummington Street.
There will be about 5 programs, a midterm and a final. The course grade will be based on homework - 50%, midterm - 20% and final - 30%. Points will be taken off for late homework and incompletes will not be given.
Assignment #0 (Not to be turned in) :
1. Get a computer account by running new on csa. You can do this in the CS Dept lab which is in the third floor of 730 Commm Ave, above Radio Shack.
2. Add yourself to the CS 111 mail list. To do this type: csmail -a cs111
at the Unix prompt.
3. Run the program netscape and then open the document http://www.cs.bu.edu/faculty/homer/111/Home.html
4. Take a look at the various pointers on the class home page. In particular you will need to know about Unix, Emacs and some sort of mail handler.
5. Perform the following tasks on csa. (You will need to run "new" to request an account and wait for the account to be activated before you can proceed.)
1. Log on.
2. Use emacs to create and save the C++ program written below.
3. Compile the program using the g++ compiler.
4. Execute the program, providing input as requested. You should run it three times on three different inputs.
5. Produce a listing of the program and its output on the printer.
6. Logout
/* * * age.cpp calculates your age, using the current year and the year of your * birth. * * S. Homer * May 1, 2002 */ /* #include <iostream> main() { int birth_year, current_year = 2002; cout << "\nIn what year were you born?\n"; cin >> birth_year; cout << "\nSo you will have birthday number " << current_year - birth_year << " in " << current_year << endl; }6. Write, on paper, a program fragment that interchanges the values of two integer variables x and y. So your fragment should,
i. Input values for x and y using cin
ii. Execute several (3) assignment statements which give x's value to y and y's value to x.
iii. Print out the values of x and y, which have now been switched. You may use extra variables if you need them.
(Please be clear on this. I'm NOT asking for a print statement that switches the two values by outputting x's value for y, and y's value for x.)