Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

C code include include using namespace std int main string text I ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

How can DHCP be used for mobility and support of mobile IP?

Answered: 1 week ago

Question

What amount after being increased by 210% equals $465?

Answered: 1 week ago

Question

$750 is what percent more than $250?

Answered: 1 week ago

Question

How much is $10,000 after an increase of _3%? 4

Answered: 1 week ago