Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve according to the test case given below in c++ 3. Write a recursive method called substring that takes as parameters a string, a start

image text in transcribedsolve according to the test case given below in c++

3. Write a recursive method called substring that takes as parameters a string, a start index, and an ending index, and that returns a specified substring of the string. You are implementing a recursive alternative to the standard substring method. As with the standard substring method, your method should return the substring that begins at the start index and that extends to the character just before the ending index. For example: substring("hello", 0, 2) should return "he" substring("hamburger", 4, 8) should return "urge" substring("smiles", 1, 5) should return "mile" substring("howdy", 3, 3) should return ""

Test case:(should be true)

//Write test cases for type double TEST(subStr, T1){ string str="he"; EXPECT_EQ(str,substring("hello", 0, 2)); } TEST(subStr, T1){ string str="urge"; EXPECT_EQ(str,substring("hamburger", 4, 8)); }
3. Write a recursive method called substring that takes as parameters a string, a start index, and an ending index, and that returns a specified substring of the string. You are implementing a recursive alternative to the standard substring method. As with the standard substring method, your method should return the substring that begins at the start index and that extends to the character just before the ending index. For example: substring("hello", 0, 2) should return "he" substring("hamburger", 4, 8) should return "urge" substring("smiles", 1, 5) should return "mile" substring("howdy", 3, 3) should return

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

Students also viewed these Databases questions