COSC 071: Computer Science I

Homework 2
Fall 2001

Written due in lecture, Wed, Sep 19th
E-mail due: Sep 19 @ 5 PM
5 points

This homework is designed to get you familiar with entering, compiling, and submitting C++ programs using either Visual C++ (Windows), CodeWarrior (Windows), or GNU g++ (UNIX).

  1. Using either CodeWarrior (Windows), Visual C++ (Windows), GNU g++ (UNIX), or a C++ compiler of your choosing, enter, compile, and run the C++ programs Program 2.1 (page 51), 2.2 (page 53), 2.6 (page 57), 2.8 (page 68), 2.9 (page 75), and Program 2.11 (page 94).

    You can find CodeWarrior and Visual C++ on the UIS Windows machines that litter campus. We'll be submitting all projects this semester via e-mail using pine on the gusun system, so if you plan on using CodeWarrior or some other Windows or Mac C++ compiler, then you'll need to use DOS ftp or ws-FTP to transfer your source code from a Windows machine to gusun. There is a transcript of a DOS ftp session on the COSC-071 FAQ page. Also see: HOWTO transfer files to gusun with ws-FTP, HOWTO compile using Visual C++, and HOWTO compile using CodeWarrior

    You can find the GNU g++ compiler on gusun, a UNIX machine. Use a telnet program to connect to these machines from the Internet or from a Windows machine on the campus network. Also see: HOWTO compile using g++

    Note that students in previous classes had trouble with Microsoft's telnet client. Plus, it isn't secure, so I'd recommend using a secure telnet client, like SSH. There's also NetTerm, which isn't secure.

    The editors on gusun are named ``vi'', which is a full-screen editor, and ``pico'', which is also a full-screen editor. The documentation for these editors is available on-line. For vi, type at the UNIX prompt ``man vi'' for UNIX's on-line manual pages. There are also several links to Web pages from the class's main page. Note that vedit is a version of vi that is intended for beginners. For pico, once inside the editor, you can type Control-G to get help. If you plan to use UNIX this semester, I'd highly recommend learning to use vi. pico is simple, but it is also simplistic, especially for editing C++ code.

  2. Do exercises 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.12, 2.17, 2.20 on pages 98-100 in Cohoon and Davidson and submit these written exercises in lecture.

    Note: For problem 2.8, remove both include statements.

  3. To learn how we'll be submitting projects, from gusun, e-mail an electronic version of Program 2.11 to your TA. Use your netid and the suffix ``.cc'' as the subject line. Regardless of what extension you use for your C++ program on your local machine, you must use the .cc extension in the subject line.

    If you plan to use CodeWarrior or Visual C++ this semester, then you first must use ftp to transfer your source file from a Windows machine to gusun. A transcript of an ftp session appears on the COSC071 FAQ page. You can also use ws-FTP, which is a GUI version of ftp.

    Once you use ftp to put your source file on gusun, use a telnet client to log in. This semester, you'll be submitting projects via e-mail using pine. Do not use another e-mail client. To run pine, type at the UNIX prompt:

    gusun% pine
    

    When the menu appears, select the menu item for composing e-mail. Assume that your netid is ab123, the name of your source file is prog211.cpp, and your TA's e-mail address is ``imagoodta@cs.georgetown.edu''.

    Type your TA's e-mail address in the To field, and type your netid with the .cc suffix in the Subject field (no spaces before or after). Move the cursor down into the MESSAGE TEXT screen, and type the ^R command. Pine will ask for a file name (e.g., proj211.cc), which it will then load as your message text. At this point, your screen should look something like the following (for the information above):

    Finally, type ^X to send the e-mail to your TA.

    The TAs who will be grading your projects this semester is listed on the main page. You must e-mail your project before 4:00 PM on the due date.