Question
Search a sentence for the occurance of a pattern use the following code as a template: int srch1(const char [],const char [],int);//Search for 1 occurrence
Search a sentence for the occurance of a pattern
use the following code as a template:
int srch1(const char [],const char [],int);//Search for 1 occurrence void srchAll(const char [],const char [],int []);//Search for all occurrences void print(const char []);//Print the character arrays void print(const int []); //Print the array of indexes where the pattern found
//Program Execution Begins Here int main(int argc, char** argv) { //Declare all Variables Here const int LINE=81; //Size of sentence or pattern to find char sntnce[LINE],pattern[LINE]; //80 + null terminator int match[LINE]; //Index array where pattern was found //Input a sentence and a pattern to match cout Search a sentence for the occurrence of a pattern. Report the position where the pattern occurs. It might not occur occur only once, or could occur many times. Find all the matches and output their position in the sentence. The position starts at index-0 at the beginning of the sentence
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started