/************************************************
** Your very first example of recursion! Use
** the debugger to step through this program!
************************************************/
#include <iostream>
using namespace std;
void stars(int);
void line(int);
int main()
{
line(4);
return 0;
}
void line(int k)
{
// base case
if (k < 0)
return;
// draw a line of k stars
stars(k);
cout << endl;
// Print a line of length k-1
line(k-1);
}
void stars(int k)
{
// base case
if( k <= 0 )
return;
// recursive case
cout << "*";
stars(k-1);
}