#include
#include
#include
static bool default_map[] = {
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
};
void print_row(bool* map, size_t width, size_t xspc, char symbol)
{
for (size_t col = 0; col < width; ++col)
{
printf("%c", map[col] ? symbol : ' ');
for (size_t x = 0; x < (width - col) && x < xspc; ++x)
{
printf(" ");
}
}
}
void print_rows(bool* map, size_t width, size_t height, size_t xspc, size_t yspc, char symbol)
{
for (size_t row = 0; row < height; ++row)
{
print_row(map + width * row, width, xspc, symbol);
for (size_t y = 0; y < (height - row) && y < yspc; ++y)
{
printf("\n");
}
}
}
int main()
{
print_rows(default_map, 13, 13, 2, 1, '*');
return 0;
}
Rate my FizzBuzz, Jow Forums