I need help with checking if the position in array must save ' ' or '*' for later in program to print out a pyramid.
At the moment I get out something like this:

This is my code for filling the array:
for (int i = 0; i < t.GetLength(0); i++)
{
for (int j = 0; j < t.GetLength(1); j++)
{
if (j == t.GetLength(1) / 2 || j == t.GetLength(1) / 2 + i || j == t.GetLength(1) / 2 - i)
{
t[i, j] = '*';
}
else t[i, j] = ' ';
}
}
Aucun commentaire:
Enregistrer un commentaire