Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Earlier in the semester, you wrote an iterative version of find called indexOf(). Now, write a recursive version. The function takes two string parameters, s1

image text in transcribed

Earlier in the semester, you wrote an iterative version of find called indexOf(). Now, write a recursive version. The function takes two string parameters, s1 and s2 and returns the starting index of s2 inside the first string sl, or -1 if s2 is not found in sl. You must not use any loops; you also cannot use the string member functions find or rfind. You may use the member functions size, at and substr. Your function must be recursive. Complete the following file: IndexOf.cpp 1 #include 2 using namespace std; 3 4 int indexOf(const string& si, const string& s2) 5 { 6 7 8 9 10 } OOOO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

What information does the times interest earned ratio provide?

Answered: 1 week ago

Question

How do books become world of wonder?

Answered: 1 week ago