#include "ft_putchar.c"
int pad_val(int n) //Use this func to calc Num of padding chars
//for either the rows or columns.
{
if (n < 3)
{
return n;
}
return (n -2);
}
void pad_x(int n) //Use this to generate a row of padding chars.
{
int i;
i = 0;
while(i < n)
{
ft_putchar('B');
i++;
}
}
void pad_y(int n) // Use this to generate a column of padding chars.
{
int i;
i = 0;
while(1 < n)
{
ft_putchar('B');
write(1,"\n",1);
i ++;
}
}
int main(int argc, char *argv[] )
{
int cols;
int rows;
cols = 7;
rows = 7;
pad_x(pad_val(cols)); //call pad x with the value
//of the middle padding length.
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: