CSC 161 Grinnell College Fall, 2011 Imperative Problem Solving and Data Structures

# CSC 161 Module to Introduce Arrays, Functions, Testing, and Addresses

## Introduction

This module introduces CSC 161 students to fundamental elements of programming in C, including

1. Arrays
2. Functions and Parameters
3. Testing

## Day-by-day Details

Day Topic Preparation In-class Due Date Availability
for
Extra
Credit
Monday, September 19 Examples
Module 2: Arrays, Functions, Testing, Values, and Addresses
Examples:
Tuesday, September 20 Arrays
• K&R: 1.6, 1.9, 5.7
lab exercise
Wednesday, September 21 Functions
• K&R: 1.7, 4.1-4.3.
lab exercise
Friday, September 23 Hour Test 1
Monday, September 26 The & Operator and Addresses
• K&R: 5.1, 5.2
lab exercise
Tuesday, September 27 Testing lab exercise
Wednesday, September 28 Project   Uninterpretable Dance Due:

## Project: Uninterpretable Dance

Working in pairs, students should develop a program which makes the robot perform a randomized dance. That is, the program should have these features:

• The program should define at least five functions, each of which instructs the robot to follow a sequence of activities (beeps and movements).
• The sequence for one function must be different from the sequence for each of the others.
• The main program should make at least five calls at random to the five movement functions. That is, the main program should ensure that the functions are called in a random order, and the program should call at least five functions during its execution.
• The program need not ensure that each function be called at least once for any single run of the program, but all functions should have equal probability of being called in each program execution.
• Each time the program is run, the robot should perform the dance in a different order.

This project will be worth 25 points, based on the following rubric:

• The dance has at least 5 unique dance sequence functions (5 points)

• The dance is properly randomized (5 points)

• The program uses arrays and pass-by-reference calling of functions with array parameters (5 points)

• Evidence of testing is included (5 points)

• The dance sequences are creative (5 points).

This document is available on the World Wide Web as

```http://www.cs.grinnell.edu/~walker/courses/161.fa11/modules/module-arrays-functions/module-arrays-functions.shtml
```

 created 19 July 2011 by Dilan Ustek last full revision 26 July 2011 by Dilan Ustek dates revised 2 September 2011 by Henry M. Walker For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.