Navigate to the directory SourceCode and then the directory Chapter01. Open the file 01-10.cpp (double-clicking should open it). Select all of the text and copy. Switch over to your Helios session in Putty. First, you need to start editting a file. To edit a file, you type one of the following commands. CS majors should use vi or vim. Other majors can use pico if they find it easier.
vi <filename> vim <filename> pico <filename>Replace <filename> with the name of the file, in this case 01-10.cpp. To paste in Putty, you must press SHIFT+INSERT. The standard Windows CTRL copy and paste do not work in Putty. Save your program and exit the editor. In Pico, use CTRL-X to save and quit. In vi/vim, use :x to save and quit.
You will now be back at the Helios prompt. To compile and link your program, type the following:
g++ <filename>To run your program, type the following:
./a.outIf your program ever stops responding, you can press CTRL-C to stop it and return back to the command prompt. Otherwise, your program will run and when it is complete, you will return back to the command prompt.
You can also give your executable a name. To name our 01-10.cpp file program 01-10, the following command would be issued:
g++ -o 01-10 01-10.cppAnd to run that program, you would type:
./01-10The "-o" option tells the compiler what to name the executable file. If you do not specify the "-o" option, your executable is called a.out, as in the first example. There are many options to g++. If you are interested, look at the manpage for g++ by typing "man g++".
Now let's play around with inducing intentional errors in the program. First, create a copy of the 01-10.cpp file called 01-10-errors.cpp by issuing the following command:
cp 01-10.cpp 01-10-errors.cppNow use Pico, vi or vim to edit 01-10-errors.cpp. Delete the semi-colon on the cout line. Save the file and exit the editor. Compile 01-10-errors.cpp and see the error message g++ produces.
Now, copy 01-10.cpp to 01-10-errors.cpp again to start with a fresh, working copy of the file. This time, delete the line "using namespace std;". Compile again and note the error message.
Again, copy 01-10.cpp to 01-10-errors.cpp. Delete one of the "<" on the cout line. Compile and note the error message.
If you wish, you can also copy 01-08.cpp from the CD to Helios and try deleting parts of it to see what error messages are produced.
pico .forwardOnce you are editting .forward, type the email address you wish to have the email forwarded to, for example:
yourname@gmail.comThen save and quit.
Even if you forward your Helios email elsewhere, you can still use the Pine email client on Helios to send email. If you do not forward your email elsewhere, you also use Pine to read your email. The department guide on Pine has instructions on how to use Pine to send and read email. Pay particular attention to the sections on how to compose email and send attachments as you will need to do that to submit assignments. All assignments must be submitted via Helios.
To send email to others on Helios, you only need to type their username into the To: line and hit enter. If you have typed their username correctly, their full name and email address will automatically appear on the To: line. This is very helpful to make sure that you have not typoed the username. For example, to send email to me, just type mdanfor in the To: line and hit enter. If you have typed it correctly, you will see:
Melissa Danforth <mdanfor@helios.cs.csubak.edu>
All lab and homework assignments should have the subject line "CS221 - <assignment>", such as "CS221 - Lab 1". You will attach the code files to the email to submit them. In the body of the message, type your name and which files you have attached. That way, if the file is not properly attached, I can see from the message body what assignments you intended to submit and can email you so you can resubmit the assignment.