I'm tring to write a recursive function that takes as a parameter a non-negative integer and generates the following pattern of stars if the integer is 4.


*
* *
* * *
* * * *
* * *
* *
*




Below is the code I have so far. Which gives me


*
* *
* * *
* * * *



Can anyone explain how to get the other half?


Code:
#include <iostream>
#include <iomanip>
#include<fstream>
using namespace std;
int func(int x);
 
int main(int argc, char *argv[])
{
int number;
 
func(4);
 
system("PAUSE");
return 0;
}
int func(int x)
{
int i;
 
if (x>=1)
func(x-1);
for (i=1; i<=x; i++)
{
cout<<"* ";
}
cout << endl; 
return 1;
}