The unix "script" utility is a simple and effective way to capture output from your programs for submission as part of your programming assignments. It is essentially a "tape recorder" that you can turn on and which then --- until you turn it off again --- records everything that happens in your console window to a file. You can then print this file to turn in.
Turning on the script utility is easy: You just type "script <filename>" where <filename> is the name you want to give the output file where everything will be saved. After you type this, script will give you a short message to let you know it's recording. You then proceed to compile and run your program as usual.
When your program is done running, you "turn off" script by simply typing "exit".
Now, when you do an "ls", you should see a new file called <filename> in your directory. If you do "more <filename>" to view it, it should convince you that you've captured your program output.
In sum, the process usually works like this:
See me if you have questions....