report - Project 4Computer Science 31 Ahmad El-Arabi The...

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

View Full Document Right Arrow Icon
Project 4—Computer Science 31 Ahmad El-Arabi The first eight functions were solved with relative ease. But when it came to the final two functions (mingle and split), it was very tempting to define an array and use it within the function. But this was not possible because of the fact that we don’t know how large the array we are going to receiving will be. In order to solve this problem, I had to really sit down and think about efficient ways to implement loops to achieve the solution. For example, in the function mingle I decided to solve it by adding each element to the final array. Then I sorted this array and arranged it based on increasing order. Other than this problem, I completed the rest of the project with relative ease. Test Values: int  tally( const   string  a[],  int  n,  string  target) : a[8] = { “homer”, “marge”, “bart”, “lisa”, “maggie”, “moe”, “apu”, “flanders” } o n = 0; target = “apu” -- An empty array. o n = -1; target = “apu” -- A negative value for n. o n = 2; target = “apu” -- String that is not within the first two elements. o n = 8; target = “bob” -- String not within in the entire array. o n = 8; target = “flanders” -- String being at the end of array. o n = 8; target = “homer” -- String being at the beginning of array. o n = 8; target = “maggie" -- String being in the middle of the array. a[1] = { “homer” } o n = 0; target = “homer” -- An empty array. o n = -1; target = “homer” -- A negative value for n. o
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/24/2009 for the course BIOENGR 10 taught by Professor Staff during the Spring '08 term at UCLA.

Page1 / 3

report - Project 4Computer Science 31 Ahmad El-Arabi The...

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

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