Stairs Program in C



I'm trying to write a stairs program. It's supposed to print stairs.
This is what I got:
+---+
| |
+---+---+
| | |
+---+---+---+
| | | |
+---+---+---+---+
| | | | |
+---+---+---+---+---+
| | | | | |
+---+---+---+---+---+---+
| | | | | | |
+---+---+---+---+---+---+
Now I can't figure out how to get it to print the inverse to the left
so it looks like a pyramid.
The code:
#include <stdio.h>

void makeTread (int n_tread)
{
int i;


printf("+");
for (i = 0; i < n_tread; i++)
{
printf("---+");
}
printf("\n");



}


void makeRise (int n_rise)
{
int i;

for (i = 0; i < n_rise; i++)
{
printf("| ");
}
printf("\n");



}


void makeStairs (int N)
{
int k;

for (k=1; k <= N; k++)
{
makeTread (k);
makeRise (k + 1);
}
makeTread (N);



}


int
main(void)
{
makeStairs (6);

return (0);



}


Can somebody give me a hint?

.



Relevant Pages

  • Stairs program
    ... I'm trying to write a stairs program. ... It's supposed to print stairs. ... void makeTread (int n_tread) ...
    (comp.lang.c)
  • Re: Stairs program
    ... void makeTread (int n_tread) ... void makeRise ... In order to draw a pyramid properly, you'll need to know the base size, ...
    (comp.lang.c)