CS 111
                                                                                                                         Summer 2002

           Introduction to Computer Science I


                       Syllabus


Steve Homer  (homer@cs)

Office:  281 MCS
Phone:   353-8927  
Office Hours: After class each day for at least 1/2 hour

Teaching Fellow: 
                  
Office: 
Phone : 
Office Hours:  

Text: "C++: How to Program" (third edition) by Deitel and Deitel

This course provides a general introduction to programming with emphasis on
elements of object-oriented programming (OOP), a way of producing reliable
and reusable code, using C++. This is the first course for CS majors, and
is also a distribution course for all CAS students.

The purpose of this course is to learn the fundamentals of
programming in a high level language. We will use the C++ language 
and learn to edit and run programs using the UNIX operating system.
Most of the first 10 chapters of the textbook will be covered. 
Topics will include  arithmetic 
and string operators, functions,  C++ data types and operators, basic I/O
and control structures, arrays and pointers. 

We will also study  the most basic element of OOP -- 
classes. Classes give us a natural and systematic way to package together 
data and operations. We will consider operator overloading and
(briefly) inheritance.
In addition we will study a variety of  data structures, 
algorithms using them, and what it means for a program to be 
efficient. Finally we will attempt to put all this in the 
context of Computer Science as a whole. In particular some of 
the currently active topics in the field will be discussed as 
they relate to various aspects of programming.

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.)