Homework 8 UCR CS10: Introduction to Computer Science Spring Quarter 2004, Lecturer: Kris Miller Due Thursday, June 3 before 8:00pm by web turnin. ------------------------------------------------------------------------------- Turnin: Turnin this assignment to the folder, hw8, using the electronic turnin linked to from the class webpage. For homeworks only, you may turnin .doc (Microsoft Word) or .txt (Notepad) files. You may also turnin the homework as a .cc or .cpp (C++ source) file. Be sure to turn it into the correct folder. At best, you will be penalized 20%. At worst, your homework may not be graded at all. ------------------------------------------------------------------------------- Note: Collaboration policy for this homework assignment Collaboration on this homework is strongly ENCOURAGED. The homework is intended for practice, not assessment -- most people who turn in decent work should get most if not all points for this assignment. Forming study groups is strongly encouraged. You shouldn't simply copy answers from any source -- each other, the book, the web, other books, previous solutions, etc. But you can certainly discuss how to solve the problems, look over each others solutions and help "debug" them, compare answers and redo problems if you determine your answer is wrong, and most importantly, explain concepts related to the problems and solutions. ------------------------------------------------------------------------------- 0. For 1 point bonus (20%), enter the names (first and last name) of the CS10 students you collaborated on this homework with. 1. Self-test Exercise #7-41 (Chapter 7, Exercise #41) 2. Self-test Exercise #10-1 (Chapter 10, Exercise #1) 3. Self-test Exercise #10-2 4. Self-test Exercise #10-5 5. Self-test Exercise #10-6 6. Self-test Exercise #10-8 7. Self-test Exercise #10-11 8. Self-test Exercise #10-14 9. Self-test Exercise #10-16 ***Self-test Exercise solutions are in the back of each chapter.*** 10. Write a function that returns the Boolean value true if 2 integer arrays are equivalent. The arrays are passed in as parameters and you can assume they are the same size. By equivalent, I mean that they have exactly the same values in exactly the same order. Use the following function header: bool equal(int a[], int b[], int size) Hint: - You can return false as soon as you find one pair of elements that doesn't match. Return true if the for loop ends without this happening. ***Solution to #10*** bool equal(int a[], int b[], int size) { for (int i = 0; i < size; i++) { if (a[i] != b[i]) { return false; } } return true; }