{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Project 4 Spec

Project 4 Spec - Spring 2009 CS 31 P Programming Assignment...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Spring 2009 CS 31 Programming Assignment 4 P Array of Sunshine Time due: 9:00 PM Tuesday, May 5 Before you ask questions about this specification, see if your question has already been addressed by the Project 4 FAQ . And read the FAQ before you turn in this project, to be sure you didn't misinterpret anything. As you gain experience with arrays, you'll discover that many applications do the same kinds of things with them (e.g., find where an item is in an array, or check whether two arrays differ). You'll find that it's helpful to have a library of useful functions that manipulate arrays. (For our purposes now, a library is a collection of functions that developers can call instead of having to write them themselves. For a library to be most useful, the functions in it should be related and organized around a central theme. For example, a screen graphics library might have functions that allow you to draw shapes like lines and circles on the screen, move them around, fill them with color, etc. In this view, the Standard C++ library is really a collection of libraries: a string library, a math library, an input/output library, and much more.) Your assignment is to produce a library that provides functions for many common manipulations of arrays of strings. For example, one function will find where a string occurs in an unordered array of strings. Another will change the order of strings in an array. For each function you must write, this specification will tell you its interface (what parameters it takes, what it returns, and what it must do). It's up to you to decide on the implementation ( how it will do it). The source file you turn in will contain all the functions and a main routine. You can have the main routine do whatever you want, because we will rename it to something harmless, never call it, and append our own main routine to your file. Our main routine will thoroughly test
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
your functions. You'll probably want your main routine to do the same. If you wish, you may write functions in addition to those required here. We will not directly call any such additional functions. The program you turn in must build successfully, and during execution, no function (other than main) may read anything from cin or write anything to cout. If you want to print things out for debugging purposes, write to cerr instead of cout. When we test your program, we will cause everything written to cerr to be discarded — we will never see that output, so you may leave those debugging output statements in your program if you wish. All of the functions you must write take at least two parameters: an array of strings, and the number of items the function will consider in the array, starting from the beginning. For example, in string folks[8] = { "homer", "marge", "bart", "lisa", "maggie", "moe", "apu", "flanders" }; int i = findFirst(folks, 5, "apu"); // should return - 1 (not found) even though the array has 8 elements, only the first 5 had values we were interested in; the function must not examine the others. Notwithstanding each function's behavior described below, all functions
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 9

Project 4 Spec - Spring 2009 CS 31 P Programming Assignment...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online