Question: In this assignment, we want to write a function that returns a substring for a given text. The function takes four parameters: 1. source:
In this assignment, we want to write a function that returns a substring for a given text. The function takes four parameters: 1. source: contains the source text 2. dist: contains the substring 3. startindex: the start index for substring 4. endindex: the end index for substring Test case: char text = "I am studying at Najah National University, which is located in Nablus. "; We want to find the name of the university. We know that the name of the university starts after the first "at" pattern, and it ends at first comma ", ", so we want to create another function that finds the index of a given char so we want to use it to find the index of "at" and ",". int indexOfAt = indexof (text ,"at"): / 16 int idexofComma indexof (text, ,")://43 int startIndex // should be 14 int endIndex : /ahould be 42 char substring (100]: findSubString (text, subString, startIndex, endIndex): cout substring endl: 1/ Najah National University Question 1: Write the code for indexOf function? Question 2: Use indexOf function to find the start and end index? Question 3: Write a code for findSubString function?
Step by Step Solution
3.49 Rating (152 Votes )
There are 3 Steps involved in it
C code include include using namespace std int main string text I ... View full answer
Get step-by-step solutions from verified subject matter experts
