I'm trying to make a function which creates a new element by calling itself recursively. I have a rough idea of how to do this but not really fully to implement this. The new element I want to create each time is a window, I've already made a function which takes care of creating the window , making a box around it and refreshing this particular window. This is what I've come up with so far
*Create a function with parameters(Height, Width, Begin_y, Begin_x)
*The function creates the first window with the current values passed to this function
*Now the function calls itself again with the same values -1 (I know this will vary in some cases, for example the height and width should shrink by going -1 or -2 but Begin_y and Begin_x would have to be called again with +1 or +2 if you're going from the outside of the console to the inside to make a recursive effect (hope this makes sense)
*The function calls itself recursively creating a new window , each smaller then the one before until it reaches some kind of limit (0 for width and height and some other limit for the position parameters)
*At last this function has to be able to refresh each window so they will be displayed properly onto the console. This might be hard because of naming, location etc. but I had an idea that everytime a window is created it gets a certain name with a value at the end like "Window1, Window2" etc.
What I find most mind boggling at the moment is how to create a new element each time the function get's called and how to give each one of them individual names which could then be used later in the function to refresh and display them.
Maybe recursion is not even the best choice, but the function must have a recursive looking effect for the windows.