Colorado State University

Recitation R1 - C Programming Tutorial

CS270: Computer Organization


The purpose of this lab is to learn the basics:

Logging In

  1. Login to the machine, using your eID (Same username that you use for RamCT).
  2. The initial password should be your student ID (or whatever password you currently use).
    Troubleshooting:

Class Website

  1. Start your preferred internet browser and type in the url www.cs.colostate.edu/~cs270.
  2. Look at the syllabus and progress tabs.
  3. Find the recitation instructions for today.
  4. Find the instructions for the first assignment.

Writing a C Program

  1. Browse to the PA1 assignment on the progress page.
  2. Create a directory for CS270 assignments, we recommend ~/cs270.
  3. Create a subdirectory for PA1, we recommend ~/cs270/PA1.
  4. The teaching assistant will explain the sample code provided.
  5. Build and run the sample program.
  6. Modify the sample program to add the computeCircle function.
  7. Modify the sample program to remove the square function.
  8. Implement the call to computeCircle in the main entry point.
  9. Build the PA1 program and test it yourself.

Compiling a C Program

To compile your program into an executable called PA1, type in the following commands to a terminal window:
$ c99 -g -Wall -c PA1.c
$ c99 -g -lm PA1.o -o PA1
To run the compiled program, type the following command:
$ ./PA1

Submitting a C Program

  1. Browse to checkin tab on the course website.
  2. Follow the instructions to login.
  3. Submit the PA1.c file and wait for preliminary testing to complete.
  4. Browse your submitted code and test results.
  5. Show the submitted code and test results to the TA to get credit for the recitation.
  6. Continue working on PA1 as time permits.

© 2014 CS270 Colorado State University. All Rights Reserved.