#include using namespace std; int find(char text[], int textLength, char pattern[], int patternLength, int startIndex) { return -1; // this is not necessarily correct! } /**************************************************************** * You do not need to understand the rest of this file. * It is meant to read input from the user, to set up data * before calling your routine, and to report the results. ***************************************************************** int main() { char original[101]; cout << "Please enter the original text (100 characters max):" << endl; cin.getline(original,100); int oLength = strlen(original); char goal[101]; cout << "Please enter the desired pattern (100 characters max):" << endl; cin.getline(goal,100); int gLength = strlen(goal); int start=0; int result=0; int count=0; bool done = false; while (!done) { cout << endl << "The driver called 'find' with a start index of " << start << endl; result = find(original,oLength,goal,gLength,start); cout << " and 'find' returned the result " << result << endl; if (result == -1) { done = true; } else { count++; if (result==oLength-1) done = true; else start = result+1; } } cout << endl << "Overall " << count << " occurrences were located." << endl; }