COSC 071: Computer Science I

Homework 2
Spring 2001

Written due lecture, Wed. Feb 7th
E-mail due: Feb 7th @ 4 PM
5 points

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

  1. Using either Visual C++ (Windows), GNU g++ (UNIX), or a C++ compiler of your choosing, enter, compile, and run the C++ programs Program 2.1 (page 49), 2.2 (page 51), 2.6 (page 55), 2.8 (page 67), 2.9 (page 73), and Program 2.11 (page 92).

    You can find Visual C++ on the UIS Windows machines that litter the campus. We'll be submitting all projects this semester via the mailx command on the gusun system, so if you plan on using Visual C++ or some other Windows or Mac C++ compiler, then you'll need to use DOS ftp or WSftp 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 compile using Visual C++

    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++

    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.18 on pages 95-98 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 the last four digits of your student ID and the suffix ``.cc'' as the subject line. Regardless of what extension you use for your C++ program, you must use the .cc extension in the subject line.

    If you plan to use Visual C++ this semester, then you need to 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.

    For example, if the last four digits of your student ID is 1234, the name of your source file is prog211.cpp, and your TA's e-mail address is ``imagoodtamaloof@cs'', then you would type at the UNIX prompt:

    gusun% mailx -s "1234.cc" imagoodta@georgetown.edu < prog211.cpp
    
    You are executing the mailx command. The -s option indicates that the string "1234.cc" is the subject heading. imgagoodta@georgetown.edu is the address to which the mail will be sent. The part ``< prog211.cpp'' takes your source file and directs it into the mailx command.

    The TA who will be grading your projects this semester is listed on the main page. Strat (stratmaloof@cs) will be grading students with last names ending with the letters A-Le, and Ken (wardkjmaloof@cs) will be grading students with last names ending with the letters Lu-Z.

    You can also use pine to submit your project. After filling in the To and Subject fields (no spaces before or after), type the ^R command in the MESSAGE TEXT screen. Pine will ask for a file name (e.g., proj211.cc), which it will then load as your message text. Type ^X to send the e-mail to your TA.

    You must e-mail your project before 4:00 PM on the due date.