Question: Course Home Calculate Your BM . . . Register for Class... math Mohammad Hasan... Free APA Citation. MyopenMe This exercise is designed to be done

Course Home
Calculate Your BM...
Register for Class...
math
Mohammad Hasan...
Free APA Citation.
MyopenMe
This exercise is designed to be done as individuals, but with consultation from your peers.
If you've ever seen me give a live demo in class, you've likely heard me say "we need a bunch of these dealios" in reference to large number of '=' or '-' characters printed across the screen to form a border. This is usually when we start what I call "input output arts and crafts," printing a larger amount of text to the screen. And I always have to copy and paste to make sure my borders are the same size, or sweat a little while I eyeball the length of the lines. This week, l'd like you to write a recursive function that makes my life easier to do this...
Write a recursive function that returns a string and takes arguments for the character the user wants to repeat and the number of characters they want. The function must solve the problem recursively and not using any loops. You can call the function anything you want, but here is an example of how I picture it being used to create the same border I created above.
cout dealios('=',50) endl;
Just remember, no loops. Your function must use a recursive function call to create the repetition. Here are some questions to ask yourself before you begin implementation to help you succeed.
What sort of operation do I need to do to build up the string with each recursive call? (Hint: It rhymes with "conglutination" and uses an operator you usually use for something else.)
What is it I need to add to the string in this recursive call so that after n number of calls I put together the entire string?
What do I need to modify in my recursive call so that I don't end up with infinite recursion?
How do I know when I've reached my base case and need to stop making recursive calls?
What to Submit
You should submit the main.cpp file containing your recursive function implementation.
 Course Home Calculate Your BM... Register for Class... math Mohammad Hasan...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!