Recursive code for squares

Any expert of C++ programing please help me in my class assignment.
400 Bad Request
The request cannot be fulfilled due to bad syntax.
I want a recursive code for making squares
I see, you didn't understand the undefined behaviour of your request as suggested by L B. Can you better expand on what you mean by "squares"? Square boxes, brownie squares, drawing squares or the mathematical application of sqaure ie square root?
These are square boxes
but the problem is complicated bcz of many square boxes
how can i send you the diagram of these square boxes??

Last edited on
Click the screen name, and on the bottom should be option to send message
The point of a public forum is that other people with a similar problem can find the thread and get help without having to re-ask the same question. Getting help by PM is like shutting out society from getting the same help - it is very rude.
sorry i cant understand the method of attaching a file
There is no way to attach files on this forum.

If it is an image, you an upload it to an image hosting site (e.g. imgur.com) and paste the link here.
Dude, to make this task easier, I would suggest making a code which you can feed to your program and the program will print the picture with minimum writing.

Ex code is something like:
15*s:7 s:15*s:d\n:r4
Print 15 stars, print 7 spaces, print 15 stars, print newline, repeat 4 times

This the program should then read this and print:

*************** ***************
*************** ***************
*************** ***************
*************** ***************

Hope that helps, gl
The easiest method is to actually do what the assignment asks and use recursion.

I would suggest a 2D array of booleans where you set them to true if you intend to draw a star there. A pointer to this 2D array should be passed through each call of the recursive function, possibly with the width and height too.

The function would draw a square (in the 2D array) centered at the given X,Y coordinates with the given Size. It would then call itself on X,Y at each of the corners and with a reduced size.

Basically, you are drawing a fractal to a certain number of iterations. This means you will also need a parameter to know how many iterations are left.
Topic archived. No new replies allowed.