COSC 071: Computer Science I

Homework 2
Fall 2003

Written due in lecture, Tue, Sep 16th
E-mail due: Sep 16 @ 5 PM
5 points

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

  1. Using either GNU g++ (UNIX), CodeWarrior (Windows), Visual C++ (Windows), 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).

    g++ is available on gusun. Here's help for connecting to gusun from your PC: HOWTO log on and transfer files to gusun with SSHWin. Here's help with compiling on gusun, along with some useful UNIX commands: HOWTO compile using g++

    You can install Visual C++ from the CD-ROM included with the textbook or download it from the MSDN Academic Alliance. Once you have it installed, here's help on how to compile programs: HOWTO compile using Visual C++.

    You'll be submitting all projects this semester via e-mail using pine on the gusun system, so if you plan on using a computer other than gusun, then you'll need to use the file transfer program in SSHWin to transfer your source code from a Windows machine to gusun. Here's how: HOWTO log on and transfer files to gusun with SSHWin.

    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.19, 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.

    As mentioned previously, if you plan to use a machine other than gusun this semester, then you first must use a secure file transfer program to transfer your source file from your machine to gusun. Here's how: HOWTO log on and transfer files to gusun with SSHWin.

    Once you've transferred your source file to gusun, log on to gusun or bring forward the window containing the gusun prompt. This semester, you'll be submitting projects via e-mail using pine. Please do not use another e-mail client. To run pine, type at the gusun 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 ``imagoodtamaloof@cs''.

    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). You can get your TAs name based on your last name from the class Web page. 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 are listed on the main page. You must e-mail your project before 5:00 PM on the due date for the e-mail portion of the assignment.