Question
You are required to write two overloaded functions called NestedStatements that take in the following formal parameters list: Function 1: takes as input two strings
You are required to write two overloaded functions called NestedStatements that take in the following formal parameters list:
Function 1: takes as input two strings (i.e. S1 and S2) and returns true if the string S1 appears in the string S2 at least once. Otherwise, the function returns false. For example, if S1 = "eat" and S2 = "the weather is nice" then the function returns TRUE. Similarly, if S1 = "zoo" and S2 = "the zoo is closed" then the function also returns TRUE.
Function 2: takes as input two strings (i.e. S1 and S2) and an integer reference variable count, and saves the number of times the string S1 appears in the string S2 in the variable count. For example, if S1 = "the" and S2 = "the weather is nice" then the value of count at the end of the function is 2. Similarly, if S1 = "cloned" and S2 = "the zoo is closed" then the value of count at the end of the function is 0.
Do not write and submit the main subroutine, or any include statments, these are already written and hidden from you. However, if you want to test your solution in any IDE (e.g., CodeBlocks, CLion, onlinegdb.com), then you will need to write your own main there for testing purposes.
IMPORTANT NOTES
Do not change the given functions headers.
Do not add any cout statements inside the functions.
Assume all the alphabetical characters in S1 and S2 are lowercase.
Please include function 1 and function 2 separately & then include all of the code for testing purposes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started