buffbill it should be like this
---------*
---------**
---------*--*
---------*---*
---------*----*
---------*------*
---------*--------*
---------********
plz give me code for this program by using nested loops and iostream library only
In the absence of anything more useful google pascal`s triangle and observe how the blanks (' ')
are printed on the LHS of the triangle using setw() for the same purpose as our dashes (-). Similarly, spaces will be required inside the triangle.
It's almost OK, you only need to fix a bit this loop:
1 2 3 4
for (j=1; j<z; j++)
{
cout << "*"; // with this you will draw a filled triangle
}
Hint: you want to draw only the borders so when j gets its first and last values ( 1 and z-1 ) and when i gets its last value ( 12-1 = 11 ) to draw the base. When one of these conditions are met draw a star, otherwise draw a space