This is a simple review lab to help you shake the rust off of your programming skills. It is designed to help you review the material from cs101, particularly one dimensional arrays. It is intended to be short and non-threatening to get you used to the eagle server again. Because of this, the requirements are strictly specified.
This lab will also acquaint you with with eagle, our cs SUN
Solaris based computer server. All assignments done in this class
must be turned in on eagle and run on eagle.
Once you have received your cs 102 account for the semester, you must first set the password. To do that use a telnet program and connect to eagle. You should only telnet this first time. Once your password is set, log out.
Now use ssh to log in. ssh is the “secure shell”. It is much more secure than telnet and will give some nice features that we will use later in the class.
Ssh is available built in on Macs and Linux/Unix computers. For windows users there is a free program called putty that you can download and install to give you ssh capability. (see http://www.chiark.greenend.org.uk/~sgtatham/putty/ for the putty home page.)
Or you can use the CD for windows that I gave out in class.
now log into eagle.
ssh <usename>@eagle.bridgew.edu (where you must replace <username> with your actual username)
Now copy a configuration file. Type (or paste in) the following command
cp /export/spare/faculty/jsantore/.tcshrc-cs102 .tcshrc
If you are typing the line, note that there is a space between -.tcshrc-cs102 and .tcshrc
now type
tcsh
to enter the t shell. I've set up several environment variables and features that you will probably find useful. One feature that most people will notice immediately is that you can now use the arrow key to navigate.
Now create a new folder/directory for your lab one work
mkdir lab1
and then move into that directory/folder
cd lab1
At this point you are ready to begin working on the programming part of the lab.
Please enter a candidate (enter done to stop)
Thomas
Enter the number of votes Thomas recieved
456
Please enter a candidate (enter done to stop)
Imelda
Enter the number of votes Imelda recieved
5467
Please enter a candidate (enter done to stop)
Leo
Enter the number of votes Leo recieved
3454
Please enter a candidate (enter done to stop)
Maria
Enter the number of votes Maria recieved
986
Please enter a candidate (enter done to stop)
done
Candidate Votes
% of Total Votes
Thomas 456
4.40027
Imelda 5467
52.755
Leo 3454
33.3301
Maria 986
9.51462
To write your program you will need to use an editor. In the past many students have written their programs using notepad as their editor and then used ftp to move the file to eagle. This was done because the tools available on eagle at the time were rather limited. I suggest you write your code on eagle itself after connecting through ssh using the CD that I gave you in class.
If you have high speed internet - especially from school:
Users who have fast connections should probably use emacs. It is the most full-featured of the editors. To run emacs, type
emacs <filename.cpp> &
where <filename.cpp> is the cpp file you want to edit.You will have an emacs window popup on your screen and you will be able to use menus normally. This editor also "pretty prints" your text using colored text for c++ keywords and constants. It will also indent your text for you properly giving you a better feel for your program.
The '&' character means "run this in the background". In plain english than means "give me my prompt back after you run this program"
If you have slower speed connections - mainly off campus
Use xjed, which will also displays keywords in color and indents text. It doesn't have quite as much functionality and isn't as pretty, but it is faster.
xjed <filename.cpp> &
When you are ready to try compiling what you have written
Pull your emacs or xjed window out of the way and run this command
g++ -g -o Lab1Prog <yourFilename.cpp>
I encourage you to compile often so that you don't end up with so many errors that you feel overwhelmed when you finally do compile.
If you are in your lab1 directory when you read this, move to the parent folder/directory
cd ..
(where the '..' means <parent directory> note that there is a space between
cd and ..)
now zip up the entire lab1 directory and send it to me.
zip -r lab1.zip lab1
This means zip up the entire lab1 directory (the -r flag says do everything
in the directory not just the directory itself) and put it in a file called
lab1.zip
Now prepare to email your lab to me.
type the following command
pine
Pine is a terminal based email program. From eagle, you will only be able to
send mail to bridgew.edu email addresses. You will submit your lab by email
to me this semester. However you need to configure pine the first time you use
it.
Choose 'c' to compose a mail and send me a mail with the zip file of your lab solution attached.