In this assignment, we want to write a function that returns a substring for a given...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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? 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?
Expert Answer:
Answer rating: 100% (QA)
C code include include using namespace std int main string text I ... View the full answer
Posted Date:
Students also viewed these programming questions
-
We want to write a function that counts the number of elements in a list that are larger than the average. For example. the function should return 2 for list (1. 2. 3. 4). since two elements are...
-
Write a function that takes two integer inputs and returns the sum of all even numbers between these inputs, and another function that takes two integer inputs and returns the sum of odd numbers...
-
Consider a quasi-one-dimensional steady advection-diffusion flow with the boundary conditions as illustrated in Figure 1: u(x) x=0 p=0 in = puA = 1 x 10-4 -4 kg/s Figure 1 In Figure 1, the velocity u...
-
Which of the following variables was controlled in Experiment 1? F. Amount of yeast G. Percent of molasses H. Percent of sucrose J. Carbon dioxide levels Experiment 1 Since yeast needs sucrose to...
-
The survey referenced in the previous exercise was conducted by Robert Half Technology. This company issued a press release (WhistleBut Dont Tweet While You Work, www.roberthalftechnology.com,...
-
Yadier Corporations comparative balance sheets are presented below. Yadiers 2014 income statement included net sales of $100,000, cost of goods sold of $60,350, and net income of $14,000....
-
Victor and Vincents partnership had a final profit for the year of \($40\) 500. When the partnership was formed at the beginning of the year Victor invested \($150\) 000 and Vincent invested \($100\)...
-
Bandung Corporation began 2008 with a $92,000 balance in the Deferred Tax Liability account. At the end of 2008, the related cumulative temporary difference amounts to $350,000, and it will reverse...
-
11.A simple LR circuit is connected to a battery at t = 0. The time instant at which rate of energy storage in inductor is half of power delivered by battery 2L (1) In 2 (3) In 2 (2) In (4) (4) In 3
-
Read the case study "Southwest Airlines," found in Part 2 of your textbook. Review the "Guide to Case Analysis" found on pp. CA1 - CA11 of your textbook. (This guide follows the last case in the...
-
2i 1+i 4i -1-i 14. Let A = and B. = -i 2-3i 2+i 2i 2). Find AB. [4 marks]
-
Suppose you and your teammates have been tasked by a Japanese global manufacturing corporation to organize the recruitment of employees for a major vehicle manufacturing and assembly plant in the...
-
On a chilly Sunday morning, Shaz Granger bought 30 dozen doughnuts for $75, prepared 10 litres of hot coffee and went to a farm auction. There, she sold all the coffee and all but six dozen of the...
-
Imagine that you and several of your classmates have bought the patents and production facilities of a US motor scooter company that has gone bankrupt. Given the growing market for home deliveries,...
-
You have recently been appointed as a senior advisor in the domestic and overseas trade division in your countrys ministry of trade and development. Despite a high birth rate and a good education...
-
You are the CEO of a major clothing manufacturer based just outside Manila, Philippines. Over 80 percent of your output sees you operating as a third-party manufacturer for several global brands. All...
-
On January 1, 2021, Pine Retailers purchased $100,000 of Elm Company bonds. The Elm bonds mature on December 31, 2025 and pay 7% interest. The bonds were purchased when the market interest rate was...
-
Wimot Trucking Corporation uses the units-of-production depreciation method because units-of-production best measures wear and tear on the trucks. Consider these facts about one Mack truck in the...
-
Identify and describe the relationship between the strategy formulation process and the strategy implementation process.
-
Identify and briefly describe the purpose and functions of a management system, work process and organization policy.
-
Describe the link between the size of an organization and the formalization process.
Study smarter with the SolutionInn App