Hey guys, I'm wondering if anyone knows how to write a function that draws a hollow triangle pointing to the right made up of asterisks. The horizontal width of the triangle is passed as a parameter. The statement triangle(4); would display a triangle 4 stars wide:
*
**
* *
* *
* *
**
*
The statement triangle(7); would display a triangle 7 stars wide:
*
**
* *
* *
* *
* *
* *
* *
* *
* *
* *
**
*
The statement triangle(1); would print a single star
*
The statement triangle(2); would print
*
**
*
An argument less than one simply prints a blank line.
I have no idea how to do this... and any help ya'll could give would be appreciated :) -
It's for a open-book homework assignment, and I'm not understanding it.
void triangle(int n)
{
}