#include void change_to_max(int x[4], int l, int r) { int i; i = 0; while (i < 4) { if (i >= (l - 1) && i <= (4 - r)) x[i] = 4; i++; } } void ft_putchar(char c) { write(1, &c ,1); } int main(void) { int str[16] = {3, 3, 1, 2, 1, 2, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3}; int matrix[4][4] = {{0}}; int a; int b; int c; int d; int e; int f; int g; int h; a = 0; b = 1; c = 2; d = 3; e = 12; f = 5; h = 4; g = 8; // while (a < 4) // { // change_to_max(matrix[a], str[g], str[e]); // g++; // e++; // a++; // } // int x; // int y; // x = 0; // y = 0; { int x; x = 0; while (x < 4) { int y; y = 0; while (y < 4) { if (y >= (str[a] - 1) && y <= (4 - str[h])) change_to_max2(&matrix[y][x]); y++; } x++; } } // while (b < 4) // { // if (b >= (d - 1) && b <= (4 - c)) // change_to_max2(&matrix[b][0]); // b++; // } // while (c < 4) // { // if (c >= (b - 1) && c <= (4 - c)) // change_to_max2(&matrix[c][0]); // c++; // } // while (a < 4) // { // if (d >= (c - 1) && d <= (4 - d)) // change_to_max2(&matrix[a][0]); // d++; // } int i; int j; i = 0; while (i <= 3) { j = 0; while (j <= 3) { ft_putchar(matrix[i][j] + '0'); j++; } ft_putchar(0x0a); i++; } } int x; x = 0; while (x < 4) { int y; y = 0; while (y < 4) { if (y >= (str[a] - 1) && y <= (4 - str[b])) change_to_4(&matrix[y][x]); y++; a++; b++; } x++; } }