Question: Part A (10 points): For this assignment, you will look for (that is, determine if the pattern is in the text) a specific pattern in


Part A (10 points): For this assignment, you will look for (that is, determine if the pattern is in the text) a specific pattern in a general text input. The text is read (one char at a time) and stored in a char array. If the pattern is recognized, then you will output a nice statement and indicate where in text the pattern starts (for example, position number 3). Remember, you will ONLY use pointer arithmetic and pointers for this assignment, if you use something of the form: array[index] you will lose credit. For example: Text: GCATCGCAGAGATATACAGTACG Pattern: GCAG A Match Has Been Found!!!! And It Starts At location 5 (starting from the left at 0). Now, what will your program do? First, you should assume you are searching for the pattern: "GCAG". You will code several functions as well as a main function. There should be one function that reads in some number of characters from the terminal and stores them into an array. You will use this function to store characters into your text array. You will also have a function that implements the recognizer. This function will have passed to it two char pointers, and returns an int which is the index to the location where the match starts or it returns -1 if it could not find a match (you should use this in your main function to print out the proper phrase "Yippee a match is found at location x" or "Too bad no match"). You will also create a function that is passed the char pointer of the TEXT and an int index where the match was found in the text, and of course the size of the text. A possible structure to your program is: #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
