Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 ""

Make its Header File, cpp File and I am Providing 2 G-Tests, Your Program (Header File ) Should have to pass that G-Tests

YOU HAVE TO MAKE CPP FILE FOR INPUT, HEADER FILE WHERE FUNCTION WILL EXISTS AND G-TESTS TO TEST PROGRAMS

#include "pch.h"

#include"../(address of headerfile)"

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));

}

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

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago