Is this an example of a recursive function?? Somebody on another forum helped me put this together, as I am trying to make a diamond shape out of asterisks. But he did not know if this was a correct way of using recursion. Can somebody just tell me yes or no, is this a correct example of a recursive function?? Thanks
#include <iostream>
#include <iomanip>
using namespace std;
int spaces = 5;
int main()
{
for (int i = 1; i < 5; i = i + 1)
{
cout << setw(spaces);
for (int j = 0 ; j < i; j++)
cout << "* ";
cout << endl;
--spaces;
}
for (int i = 1; i < 4; i = i + 1)
{
cout << setw(spaces + 2);
for (int j = 4 ; j > i; j--)
cout << "* ";
cout << endl;
++spaces;
}
}