Laboratory

Up

Whats New
Class Info
Calendar
Lecture
Discussion
Homework
Laboratory
TA Corner
FAQ

CS-12 Laboratory 
   (Computer Science is a lab science)

   Lab Locations

Due dates are on Calendar Page

Programs are due in class (primary turn in)

Email programs as attachments to

    cs12 @ whizbangscholar.com
 
Put your name and lab number in the subject line
   example:          Jones Lab3

  1. Lab 0   System familiarization (see below)
    GCC Setup   Set up compiler on your own machine (recommended)
    PuTTY Setup Use your Engineering account
    A note on editors  
    Batch Files used
       
    The hello.c program is on page 6 of the text.
                

  2. Lab 1  File Dump. 
         A Table of ASCII Characters you may find useful
         Lab1Data.txt A file your program should process

    Some batch files that you might find useful
       ls.bat                Lists Directory
       myprog.bat       Edit, compile, and run program. 
                               Note file redirection included to cut down on typing
       cat.bat              Prints a file to the screen

  3. Lab 2 Comment Printing
    This program is to print the comments that make your program easy to understand, maintain, and remember.

  4. Lab 3 Grapher
    This assignment allows you to write a simple graphing package. You will be using it on future assignments.

  5. Lab 4 Complex Number Package
    This assignment asks you to write a simple complex number package. The package will define a number type COMPLEX and implement simple functions as multiply by scalar, multiply, absolute value and argument.

  6. Lab 5 Linked List
    This assignment asks you to write a simple linked list facility for handling a group of records. Note: your program does not have to be able to delete the first node of the chain (that complication will be dealt with in the next Lab)

  7. Lab 6 Complex DFT
    This assignment asks you to use your complex number package and your  your graphing package to compute and display a discrete Fourier Transform. The task may seem difficult at first, but all you have to basically do is implement a simple given equation.  If you did a good job on you graphing and complex packages, then the assignment is a slam-dunk.  If you have to go back and figure out what you did before, it will take a little longer.


  8. Lab 7 Linked List Reprise
    This assignment asks you to modify your linked list from Lab 5. Your level of effort will likely depend on your care in organizing and documenting Lab 5. You may find these files useful
        a. Animals.txt    A list of animals for your program to read.
        b. A flow chart for sorting the list.
        c. A pointer diagram for exchanging two nodes in the list.
        d. A pointer diagram for exchanging the first node in the list
    If you have trouble getting started, write the functions to read the list in and print out the list.  Then move to switching two nodes in the list and printing out to verify.  Then move to the sort and verify with the list print out.  Don't forget you can use printf statements in your program to test each portion of your design as you go along.

  9. Lab 7 Graphing a Convolution
    This assignments asks you to use the fruits of you previous work and graph a convolution. The convolution is easy and so is the rest if your have your grapher well documented and designed.

A sample data set for convolving

[y] = [h] * [x]

The array y[ ] is the convolution of the arrays x [ ] and h [ ]

All other values are zero

x[0] = -2 h[0] = 1 y[0] = -2
x[2] = 1 h[1] = 2 y[1] = -4
x[3] = -1 h[3] = -1 y[2] = 1
x[4] = 3 y[3] = 3
y[4] = 1
y[5] = 5
y[6] = 1
y[7] = -3

 

bullet

Lab Locations

Lab Name Location

Jalama Lab 

Phelps 1513

Rincon Lab

Phelps 1518

Open Access Lab

Phelps 1523

Mesa Lab

Phelps 1525
Miramar Lab Phelps 1526

Leadbetter Lab

Phelps 1530

MPL Lab

Kerr 2160 (right)

Language Lab

Kerr 2160 (left)

Web Lab

Kerr 2160 (center)

ATL

Kerr 2160 (far right)

 

A note on Editors

The rule is: Find an editor that you like and use it.


Notepad is used in class because it is readily available, easy to use, and very fast. It will work well for all the  programs assigned.

Edit is also used. Edit is a DOS program that has been around since before Windows.  Works well with the GCC because they both run in a DOS box under Windows. If you don't like it, find something else and use it

There are dozens of editors available and many of them are free.

One of my favorites is the Crimson editor, available at  www.crimsoneditor.com . It is reasonably fast, allows you to have several files open simultaneously and adds color to comments and key words.  If you don't like it, find something else and use it.

You can even use Word but be sure to save your files as text files (.txt). Word is very slow for this application (not recommended).

If you want to use the Emacs editor, a short tutorial is available.  Emacs Tutorial . Emacs works on the Engineering accounts and there is even a version for Windows.

If you want to use the vi editor, a short tutorial is available at Vi Tutorial . Vi is a professional editor born in the days of the teletype. Very powerful, very steep learning curve. 

 

Program 0

The first assignment is to get familiar with the mechanics of using the gcc compiler.

You may want to run gcc on your own Windows machine.  You can get the necessary files from the site http://www.delorie.com/djgpp/   An alternate method (which you may find easier) is in 012Lab Setup.pdf.  (This is also the method described in class).

If you have an ECI account, you may wish to run the C compiler there.  You may access these machines using PuTTY.  Setup and running of PuTTY is in PuTTY setup (right click to download). 

If you want to use the Emacs editor, a short tutorial is available. 
            Emacs Tutorial

If you want to use the vi editor, a short tutorial is available
            Vi Tutorial

If you are unsure about which editor to use, just use notepad. 

Turn in items:

  1. The first item is the lab top-sheet.  These are passed out with every assignment.  They are also on the downloadable assignments.

  2. Turn in a screen shot of your program running. The may be accomplished:

    1. Use the print screen key to put an image of the screen on the clipboard. 

    2. Then paste it into a Word document.  You can crop and resize the image. You may also paste it into a Paint/PhotoShop/Canvas file or other image processing program.

    3. Only a single sheet is required.

  3. This assignment has minimal turn-in items to allow you to get your computer and files organized for the class. You do not need to upload any files for this assignment.  Future programs will require you to

    1. Turn in a complete well commented listing of your program

    2. Turn in a design-level flow-chart of your program

    3. Turn in a description of your program.

     

Batch Files Used

The following batch files were used in class. You can down load them, copy into your c:\gcc directory, and use them (Right click)

su.bat    If you have installed GCC as recommended, you can use this to set up your system.  It can be double clicked on and will bring up the DOS box

c.bat    This is a batch file to edit, compile, and run the program

hello.c    You will edit it to work with another program.  Later, we will discuss batch files with parameters so you don't even have to edit it.

ls.bat    The DOS dir command is a bit messy.  It can be fixed with a batch file. This file runs dir with a few parameter that cleans up the display. It is named after the directory lister in Unix.