Editing, Compiling, Running C++ Programs; Turning in results
Reminders: You must leave the leave the lab promptly at 50 minutes
past the hour. You must attend the lab section for which you are
registered - NO EXCEPTIONS.
Goals
The goals of this lab are to check that you have a valid CCC account, and
that you can use the UNIX shell, emacs, and the C++ compiler, g++.
This lab also gives you practice in
using the turnin program.
Lab Steps
cd~
Note the use of the tilde "~" to signify
"my home directory".
script labscript
mkdircs1005
cd cs1005
pwd
/cs/cs1005/labs/lab1/lab1.cxx to your working
directory and verify that the copy is there. You can use the shell commands:
cp/cs/cs1005/labs/lab1/lab1.cxx .
ls
Note the use of the period "." to signify "my working
directory".
lab1.cxx. You should change the comments at the beginning of the program as indicated.
Save the buffer
after you make the changes. (You can use this shell command to start the emacs
editor in the background :
emacslab1.cxx &
Note the use of the ampersand "&" to signify "run
this in the background".)
lab1.cxx using g++. You
can use the shell command:
g++ -Walllab1.cxx
There are some compilation errors in the program. Try to find and fix the errors (ask a TA
for help if you get stuck). Re-compile the program. Don't proceed to the next
step until the program compiles successfully.
a.out.
If you get an error similar to
a.out: command not found
then your PATH variable is set wrong. The easiest solution is to use
the command ./a.out
(which says "run the program a.out in the current working
directory").
Examine the scriptfile by typing
exit
more labscript
/cs/bin/turnin submit cs1005 lab1 lab1.cxx labscript
This command runs a program which submits your files electronically, so that the TAs can retrieve and grade them.
/cs/bin/turnin cs1005 verify lab1