Skip to content

Problem 1To access a subtring of a string str, you can use

    Problem 1:To access a subtring of a string str, you can use the function defined by the following function prototype:string substr(size_t startIndex, size_t length);However if startIndex > str.size(), this substr function will cause an out_of_range exception and terminate the program.Write an StrExcept exception class that inherits from the base exception class out_of_range by defining its own constructor and a print() method outputting a custom error message to the user.Then, in the main method, write a program that asks the user to enter a string before asking him/her to enter the start index of the substring and its length.This program should throw StrExcept if the start index is larger than the size of the string and handle this exception by surrounding it by try-catch block.Note that out_of_range class would require you to include stdexcept library.Problem2:Write a recursive version of the binary search algorithm.Function prototype: int bSearch(const int a[],int lo, int hi,int x)Where lo and hi are the indexes of the first and last element of the binary search.Note: You can assume that the items of the searched array to test in your main method are sorted/

    Do You Need A Similar Assignment Done For You From Scratch? We Have Qualified Writers To Help You. We Assure You An A+ Quality Paper That Is Free From Plagiarism. Order Now For An Amazing Discount!

    Very professional support! Highly recommended.


    Researched complicated topic and delivered report by the requested deadline. The paper is of a high standard reflecting careful research and clear assessments. I recommend

    Daria K


    It’s a 5 start for me. Excellent research and writing. The paper reflects a careful assessment of scientific information.



    With Gib’s reflection, they wrote a really specific essay. Very well written, containing all of the languages I required and excellent references. The writer follows my instructions and writes clearly in English.

    Mario G


    I am so grateful and I am 100% happy with your work.



    A fantastic piece of work 👏. The writer demonstrated full knowledge of the topic and applying the relevant provided material. Well done.