CS U216 -- Algorithms and Data Structures for Engineers

Assignment 3

Due 25 May, 2005

There are three parts to Assignment 3:

An example interaction might look like this. You do not need to use the exact wording that appears here.

This is a driver for testing two substring functions.

Are there more tests to run? ?
I'm sorry, please answer with y or n.
Are there more tests to run? y

Please enter the substring to search for: abc
Please enter the string within which to search: abcdabcabe
Please enter which occurrence of that substring to find: 2
The substring occurs 2 times.
Occurrence 2 is at index 4.

Are there more tests to run? y

Please enter the substring to search for: abc
Please enter the string within which to search: abcdabcabe
Please enter which occurrence of that substring to find: 3
The substring occurs 2 times.
There is no occurrence 3.

Are there more tests to run? y

Please enter the substring to search for: who
Please enter the string within which to search: Who who's whose
Please enter which occurrence of that substring to find: 0
The substring occurs 2 times.
0 is not a legitimate occurrence argument.

Are there more tests to run? n



Last updated 24 May 2005.