Anda di halaman 1dari 8

CSE1PES : PROGRAMMING FOR ENGINEERS AND SCIENTIST

LAB 0 : INTRODUCTION TO PES LABS


OBJECTIVES

Rules, benefits, access and safety

Overview of lab practices

Learn how to access common resources and learning tools

Learn how to set up your folders, write code, compile and run

TOOLS

Putty

for connecting to the unix server

Notepad ++

for writing code

Unix

server for compiling and running programs

THIS LAB IS NOT ASSESSABLE

TASK 1 : INTRODUCTION
The demonstrator will take you through important information about the labs and assessments in this
subject, as well as the rules in the lab. Please take notes.

TASK 2 : FAMILIARIZE YOURSELF LA TROBE TOOLS


1.

Turn on computer and login using your username and password

2.

Open an internet browser of your choosing and navigate to http://www.latrobe.edu.au/students

3.

Tools
a.

Study Tools: Provide common tools you will use in your study. To access open the panel on
the right hand side labelled Study Tools as shown in Figure 1, a summary of each tool is
provided in Table 1.

Figure 1: Study tools

STUDY TOOL

SUMMARY

Ask a question

FAQ for future, current and international students, phone number for ASK La Trobe and ask
a question form.
Search for Jobs
Shows how to change your student account password
Access to your email account and instructions how to access from phone, tablet, etc.
Ensure you can login and you check your email regularly!
Access to a range of tools provided by the library
Learning environment that includes your learning material and activities for each subject.
Ensure you can login and you check LMS regularly!
Download Office 365 for your home use, includes Word, Excel, OneDrive, Etc
Enrolment tools
Enroll in labs, tutorials you will be attending, and gives you your timetable.
Ensure this is done!
Explanation of Turnitin
University social media tool
Connect to wifi on campus and using eduroam

Career Hub
Change password
Email
Library
LMS
Office 365
StudentOnLine
Allocate Plus
Turnitin
UCROO
Wireless Network

Table 1: Study tools Summary

b.

Campus Specific Tools: Tools that can be used across campus. Can be found in the middle
of the page.

c.

Lost on Campus: App for your phone to ensure you dont get lost on campus. Can be found
on the right hand panel

TASK 3 : FAMILIARIZE YOURSELF WITH LAB TOOLS AND SETTING UP


1. Open My Computer
2. You should find a drive named U:, click and open it, this is your space to save your files on the
La Trobe Unix servers.
3. Create folders Lab0, Lab1 and so on as shown in Figure 2 (ensure you do not use spaces in
directory name)

Figure 2: Folder structure for labs

4. Open the program Notepad++, and create a new file (File>New)


5. Navigate to Language and select C as shown below

6. Save file in the created Lab0 directory (File > Save As), as helloworld.c
7. Write the code below into your file

8. Save your file


9. Open the program Putty
10. Enter latcs5.cs.latrobe.edu.au in hostname as shown below and then click Open

11. In the window that appears enter your normal login information (eg. Student id or username) you
used to login to the PC (Note password will be typing even though it appears not to be). You are
now on the Unix server

12. Type ls to list the contents of the current directory. You should see similar to below, if not review
Task 2.

13. Type mkdir temp and then ls. What did this command do? What happens in your U: drive in
windows?
14. Type rmdir temp and then ls. What did this command do? What happens in your U: drive in
windows?
15. Type cd lab0 to change the current directory to lab0. Type ls and you should see similar to
below, if not review Task 2.

16. Type cd .. and then ls. What did this command do?
17. Return to the lab0 directory
18. The program is currently just text. To translate this into code, we use what is known as a
compiler. We will be using the GNU compiler known as GCC. Enter the following commands into
the command line to compile your code.
cc -Wall o helloworld helloworld.c

19. Type ls, what has changed?


20. Type helloworld to run the program.

TASK 4 : DEALING W ITH ERRORS AND W ARNINGS


1. Open helloworld.c used earlier in notepad++
2. Add the line of code as shown below

3. Compile the program again and you should receive the following message

This is a warning as shown by the warning keyword. This explains that the variable a is declared
but not used on line 7. The program will still compile and run.
4. Delete the line you added in step 2.
5. Add the line of code shown below

6. Compile the program again and you should receive the following message

This is an error as shown by the error keyword. This explains that there is no type named integer
and is on line 7. The program will NOT be compiled and will NOT run with errors. The
previous executable will still be able to be run however.
7. Remove the line of code added in step 5 and recompile.

Summary of some Unix commands

ls

List the contents of the current directory

ls -la

List all the contents showing the permissions

cd ~

Change to the home directory

cd ..

Change to a higher directory

rm indy.html

Remove (delete) the file indy.html

mkdir lab1

Creates a directory under the current directory called lab1

rmdir lab1

remove the directory lab1

cd lab1

Change to the lab1 directory

logout

Log this user out of the current linux session

cp file1.c file2.c

Create a new file called file2.c and copies the contents from
file1.c to file2.c

Anda mungkin juga menyukai