Our First Programming Assignment

The goal of this assignment is for you to edit a
C++ program using emacs, save the program,
compile it and run it.

By "edit," I simply mean type in the program
using a text editor.  There are no changes that
need to be made to the program.

These are the steps you should follow:

  1. Start emacs (see the emacs How-to for some details)
  2. Type in the program exactly as you see it
  3. Save the program as first.c (this is important!)  In fact, you might want to save from time to time as you are typing in the program, in case something goes wrong.  It will keep you from losing all your work.
  4. In the terminal window, type  g++ first.c  This will compile your program, and create a new file called "a.out" in your home directory.  You can see this file if you type ls
  5. If you did not get any error messages during compiling, then you can run your program.  If you did get errors, look at the error messages to see what line they occured on, go to the corresponding line in your emacs window, and make the appropriate corrections
  6. To run the program, type  a.out  at the command prompt.


What you should turn in:
At a command prompt, type the following line

whoami >> wi ; echo 99 | a.out  > wj ; cat wi wj | lpr

This should generate a printout, which is what you need to hand in on Tuesday.
Note that this will print out in the Austin lab, even if you are doing it from home.