CISC 130
Problem Solving in Natural Sciences (C Programming)

Spring 2009, Section 2 (AM)

Dr. Rick Smith

Computer and Information Science
s

Dr. Smith HomeResearchClassesBlackboardCryptosmithQMCS Home | UST A-ZUST Home

last update: February 1, 2009

Announcements

Assignment 12 deadline has been changed to the end of the day on Tuesday 4/28.

You do not have to attend the lab session on 4/28 if you have completed Assignment 12.

Contents

Class Schedule

Note that there are required reading assignments listed here. "Kaplan" readings are from the MatLab book; "K&R" readings are from the C book.

Be sure to study course lecture notes. A day's lecture notes are linked to the day's topic title.

Homework is generally due before class on lecture days (Monday, Wednesday) and may be handed in after class on lab days (Tuesday, Thursday).

Date Day Topic Reading Hand In
2-Feb Mon Course introduction

3-Feb Tue Matlab introduction Kaplan, Ch 1-2
4-Feb Wed Matlab complex expressions Kaplan, Ch 3  
5-Feb Thu Lab
#1 Expressions
9-Feb Mon More Matlab Expressions
 
10-Feb Tue Lab

11-Feb Wed C Introduction
#2 Matlab Basics
12-Feb Thu Variables, Lab

16-Feb Mon Input functions, flow chart, IF statement
 
17-Feb Tue Lab

18-Feb Wed If-else, Else-if
#3 BuildABoat
19-Feb Thu Functions, Recursion, Lab

23-Feb Mon Functions

24-Feb Tue Lab

25-Feb Wed Looping, do-while
 
26-Feb Thu Lab

2-Mar Mon while loop
#4 Payroll (end of day)
3-Mar Tue Number sizing, for loop, Lab K&R, 1.1-1.3
4-Mar Wed Character processing
 
5-Mar Thu Lab
#5 Overflow test
9-Mar Mon Formatting, Function examples K&R, 1.4-1.5
10-Mar Tue Lab; Arrays

11-Mar Wed Arrays and Functions K&R, 1.6 #6 K&R
12-Mar Thu Lab, Casting

16-Mar Mon Review of Functions, Arrays K&R 1.7-9 #7 Array Functions
17-Mar Tue Exam Review

18-Mar Wed EXAM 1

19-Mar Thu Lab
#8 Variable Arrays
23-Mar Mon Spring Break

24-Mar Tue Spring Break

25-Mar Wed Spring Break

26-Mar Thu Spring Break

30-Mar Mon History of computing

31-Mar Tue Data types and conversion, Lab K&R 2.1-2.7
1-Apr Wed Word sizes, strings

2-Apr Thu Lab
 
6-Apr Mon Word Counting, Functions
#9 History Paper
7-Apr Tue Lab
8-Apr Wed File I/O K&R 7.5, 7.7  
9-Apr Thu Lab
#10 Word sizes
13-Apr Mon Easter Holiday

14-Apr Tue I/O Programming, Lab

15-Apr Wed Reading a File, String Search

16-Apr Thu Lab

20-Apr Mon Scaling Numbers
 
21-Apr Tue Lab #11 Phone Lookup
22-Apr Wed Projects, Number Scaling
 
23-Apr Thu Assignment 12, Lab
P1: Proposal
27-Apr Mon Lab    
28-Apr Tue Lab
#12 Scaling
29-Apr Wed Return to Matlab, Project Planning (elm file) Kaplan, Ch. 4

30-Apr Thu Lab
P2: Plan
4-May Mon Matlab m files, fuctions Kaplan, Ch. 5-6 #13, Indexing
5-May Tue Lab

6-May Wed Matlab control flow Kaplan, Ch. 7-8 #14, M File
7-May Thu Lab
 
8-May Fri Extra Lab time    
11-May Mon Lab #15, M File II
12-May Tue Exam Notes - Lab (REVISED)

13-May Wed Exam review (Click here for examples!)
 
14-May Thu Project Demos
P3: Demonstration
15-May Fri Extra Lab time    
19-May Mon Final projects due by MIDNIGHT   P4: Project files
20-May Wed FINAL EXAM 8:00-10:00 AM #16, Functions II

Assignments

Assignment 1: Kaplan, pp 32-33, Exercises 2.1 through 2.4

Assignment 2: Kaplan, pp 61-63, Exercises 3.1, -2, -3, -4, -7, -8, -9

Assignment 3: Build-A-Boat program

Assignment 4: Payroll program

Assignment 5: Overflow program

Assignment 6: K&R

Write a program that meets the requirements of Kernighan & Richie (K&R) Exercises 1-3 and 1-4 (page 13). In other words, write a program that uses a for loop to print out a table for converting from Celsius to Fahrenheit. There should be a heading above the table. The output should be cleanly formatted like the example outputs shown on pages 11 and 13.

E-mail the source code of the C program to the instructor by the due date.

Assignment 7: Array Functions in C

Assignment 8: Variable length arrays in C

Modify Assignment 7 as follows:

Assignment 9: History Paper

Assignment 10: Program to count word sizes

Assignment 11: Program to look up phone numbers

Assignment 12: Program to display scaled data

Assignment 13: Matlab Indexing (Exercises in Kaplan)

Assignment 14: Matlab Arrays and scripts (Exercises in Kaplan)

Assignment 15: Matlab Scripts (Exercises in Kaplan)

Assignment 16: Matlab Functions II (Exercises in Kaplan)


Exam Prep Examples

For exam prep, we worked two problems, a matrix problem and a string problem.

The matrix problem: We needed a function to multiply each element of a vector by a constant, and sum the result. The arguments included the vector and the constant (and for C, the length of the vector).

The string problem: We needed a function that took an input string and split it into 2 output strings. In Matlab, the function took a string and an index as arguments and returned two results. In C, the function took 2 strings as arguments, and an index, and returned no results (void); instead it shortened the input string and copied the split part to a second string.