I have to use a recursive function to print a ruler to the screen. it looks knida like this:
Code:
|       |       |
|   |   |   |   |
| | | | | | | | |
|||||||||||||||||
execept it will be about 65 characters long, and 7 lines deep.

here is my code:

PHP Code:
// ruler.cpp
// ---------------------
// uses a recursive function to print a ruler to the screen

#include <iostream.h>

void subdivideint loint hiint levelchar line[])
{
    if(
level == '0')
        return;
    
// get and mark midpoint
    
int mid = (lo hi) / 2;
    
line[mid] = '|';
    
// call again for left side
    
subdivide(lomid-1level-1line);
    
// call for right side
    
subdivide(mid+1hilevel-1line);
    return;
    
}

int mainvoid )
{
    
char line[66];
    
int i;

    
// prepair the array
    
for(i=0i<66i++)
    {
        
line[i] = ' ';
    }
    
line[0] = '|';
    
line[64] = '|';
    
cout << line << "\n\n\n";
    for(
i=0i<7i++)
    {
        
subdivide(065iline);
        
cout << line << endl;
    }

    return 
0;

I dont get any errors when I compile it in VC++ 6, but when i run the exe it dies saying there is an error. when i try to use the debug thing, it says stack overflow. It all makes sense in my head, so i assume i have an infinate loop somewhere that i cant see because im a new programmer.
Can anyone help?