Fall 2005

Clay Shields

front | classes | research | personal | contact

Homework 2 - Editing, Compiling and Submitting Programs

Part due in class September 22nd, 2005, and part by electronic submission prior to class time.
This homework is intended to give you practice in editing and compiling programs and in using the electronic submission system ahead of the first major programming project.

Each of these problems will require that you edit, compile, and run code. For this assignment and all others in this class, the standard compiler will be g++ on gusun.georgetown.edu.

You may also use a compiler on your personal machine, then transfer the files to gusun and then test them there. There are many compilers available (see the resources on the class web page for information on free ones, or use the Borland compiler included with the text). Most will be similar to the examples below, if not exactly alike.

What to do:

  1. For problems 25 and 26 in Chapter 2 of the text, first predict the output of each program by hand. Next, enter and compile each program and see if your prediction matches. For each program, turn in the output on paper in class. You should be able to cut and paste to do this.
  2. Enter and compile problem 27 from Chapter 2 of the text. Save it as <netid>.cc, where <netid> is your GU NetID. You will notice that you receive all sorts of compilation errors. Use the first error message to fix the first error in the program. Compile again. Repeat the above procedure until the program compiles and runs correctly.

    Now electronically submit the program from Problem 27 using the submit system.

    Using electronic submission: This semester, we will be using an electronic submission system called, oddly enough, submit. The purpose of this assignment is to set up the submit program and to make sure that you are familiar with the submission process for the projects to follow.

    First, we will set up the submit program to work with your account. Follow these instructions to do so.

    1. Log into your account on gusun. Once you log in, typing the command tcsh optionally provides a better interface that allows you to backspace and such.
    2. To copy the submit program to your account, type this command: cp ~clay/submit ./
    3. Once you have done this, use the ls command to verify that submit shows up in your directory.

    Now you can use the submit program to submit your homework. To do this, follow these instructions:

    1. Recall that <netid> means replace this with your NetId, as you should have created a file with your netid ending in .cc above. Type the command ./submit -a h2 -f <netid>.cc
    2. The first time you run the submit program, it will request some information about you. When asked, enter your name, your NetId, and finally enter COSC-071-01 for the class as is indicated in the example. You will only need to do this once. When I ran it, this is what it looked like for me.
      What is your name? Clay Shields
      What is your netid? clay
      What course are you taking (e.g., COSC-071-01)? COSC-071-01
    3. If all has gone well, you will see a message that says
      Submitting assignment...
      Shortly after that, you will get an e-mail from me confirming that you submitted your project successfully.
    4. If things don't go well, see if you can make it work based on the error messages. If all else fails, copy the text of what you did (command and all output from submit) and mail it to me, and I will see if I can help figure out what went wrong.