C++ Recursion Help

littletemple

Golden Member
Sep 18, 2001
1,359
0
0
Can someone help me solve this please: Examine this pattern of asterisks and blanks, and write a recursive function that can generate this pattern:

PROBLEM

It's problem number 4, on the bottom of the page.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Neat! If you look at the example pattern and read the text it's not too hard. Hint: what part is printed directly by the first level of recursion?

Is this for a class you're taking? It does say "assignment."
 

littletemple

Golden Member
Sep 18, 2001
1,359
0
0
Just an a practice example in the book that the teacher wants you to know how to do it so it will help on the a future project.
I've been staring at it for like 3 hrs now and I can figure it out. Can you please help me.
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
Just take a close look at the picture, line by line. You'll noticed a pattern.. it's a mirror image. The sample recursive they gave is almost complete. All you need to figure out is what parameter to use to call the recursive function.
 

calpha

Golden Member
Mar 7, 2001
1,287
0
0
on top of that, the next line would be:

<space><space><space><space>********

The parameter to me, isn't the hardest part. Recursive functions by design must have a point where the recursive function doesn't call itself anymore. The harder part to me is figuring the algorithm to code the example.