This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMSC 216 Project #1 Fall 2011 C Function Puzzles Due: September 18, 2011, 6:00PM This project is designed to give you practice with some of the operations that are different from what you’ve used in Java. You will be implementing several functions that have, in many cases, very simple solutions. However, you will not be allowed to implement the simple solution – instead, your assignment is to implement these functions using only certain operators and language constructs, the set of which will vary from function to function. Your goal is to implement the given functions with as few operators as possible, which will require a solid knowledge of how to use the operators that you are allowed to use. 1 Procedure 1.1 Obtain the project files We have provided a header file, puzzles.h , which you will need to include in your code. You can obtain this file by logging onto one of the Grace machines and executing the following command. tar -C ~/216 -xzvf ~/216public/project1/project1.tgz The tarball contains both the header file and a .submit file that you will need to submit your project. Extracting the files with the tar command given above will also place these files in a new directory, ~/216/project1 , where you should do your work for this project. 1.2 Implement the functions After extracting the project files, cd into the project1 subdirectory and create a puzzles.c file. This file will contain the implementations of the functions you are being asked to write, and should #include the puzzles.h file. Descriptions of the various functions, and the restrictions you must obey for each one, are in Section 2 . Your implementation should focus primarily on fulfilling the specification; however, as described in Section 4 , part of your grade will depend on the quality of your solutions, based on the number of operations used to implement them. 1.3 Test your implementations As for all projects in this class, the small suite of public tests we release will not be comprehensive, and you will need to do testing on your own to ensure the correctness of your functions. The results of the secret tests for this project, and for subsequent projects, will form the majority of your grade. Although we have not formally covered testing yet in the course, you should test your functions using a driver program. For example, say you are asked to write a function bit_or(a, b) that will return the result of the bitwise OR operation on a or b , but without using the | operator. In this case, you can write a function – for testing purposes only – that uses the | operator, and check your bit_or() function’s return value against the return value of this testing-only function for various inputs. An example program, tester.c , is shown below....
View Full Document
This note was uploaded on 01/13/2012 for the course CMSC 216 taught by Professor Plane during the Spring '11 term at Maryland.
- Spring '11