hi i am a beginner in c++ and have these shapes( in the attached word doc) to do using for the for the first set for loops, the second while loops and the third set do while loops. i already have done the first 2 shapes with this code:
#include <stdio.h>
void main()
{
int row, a1, a2, a3, a4, a5;
for (row = 1; row <= 5; row++) // generate the rows
{
for (a1 = 1; a1 <= row; a1++) // generate the column stars
{
printf("* ");
}
for (a2 = 1; a2 <= 5 - row; a2++) // generate the remaining box
{
printf(" ");
}
printf("\t"); // tab between shapes
for (a3 = 5; a3 > row; a3--) // generate the leading spaces
{
printf(" ");
}
for (a4 = 1; a4 <= row; a4++) // generate the column stars
{
printf("* ");
}
for (a5 = 5; a5 >= row + 1; a5--) // generate the remaining box
{
printf(" ");
}
printf("\n"); // start next row
}
printf("\n\n");
}
but now i have no idea on how to do the others? hope someone can help thanks