Homework 2 - Editing, Compiling and Submitting Programs Part
due in class FIX, 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 seva.cs.georgetown.edu.georgetown.edu.
You may also use a compiler on your personal machine, then transfer
the files to seva.cs.georgetown.edu 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:
- Enter and compile the following program:
/ This is our first real program
// Glad we didn't have to do the design yet
#include
using namespace std
int main(){
int a, b, c;
a = 2
b = 3;
c = a + b;
cout < "The sum of the numbers ois' << c;
return 0;
}
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 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.
- Log into your account on seva.cs.georgetown.edu.
- To copy the submit program to your account, type this
command: cp ~clay/submit ./
- 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:
- 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
- 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
- If all has gone well, you will see a message that
says
Submitting
assignment... Finished. Shortly
after that, you will get an e-mail from me confirming that
you submitted your project successfully.
- 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.
|