This is what I meant by using two parameters with a single recursive function:
Code:
#include<iostream>
using namespace std;
void printStars(int stars, int maxstars);
int main()
{
int lines;
cout << "Enter the number of lines in the grid: " << flush;
cin >> lines;
cout << endl;
printStars(1, lines);
cout << endl;
system ("pause");
return 0;
}
void printStars(int stars, int maxstars)
{
if(stars > maxstars)
return;
for(int i = 0; i < stars; i++)
cout << "*";
cout << endl;
printStars(stars+1, maxstars);
for(int i = 0; i < stars; i++)
cout << "*";
cout << endl;
}