diff options
| author | Matsuko Sano <msano@c1r17s9.42tokyo.jp> | 2022-08-22 17:30:07 +0900 |
|---|---|---|
| committer | Matsuko Sano <msano@c1r17s9.42tokyo.jp> | 2022-08-22 17:30:07 +0900 |
| commit | be31e6b7731a2f3142fbf29472ae1d71f82765fb (patch) | |
| tree | 53e48351cdefed0a60072e7a805e8736add02786 /rush/max_search_x.c | |
| parent | 43cbb3f685d5895bb1877f683060d7d2958d5966 (diff) | |
Diffstat (limited to 'rush/max_search_x.c')
| -rw-r--r-- | rush/max_search_x.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/rush/max_search_x.c b/rush/max_search_x.c new file mode 100644 index 0000000..244fb2d --- /dev/null +++ b/rush/max_search_x.c @@ -0,0 +1,63 @@ +#include <unistd.h> +void change_to_max(int x[4], int left, int right) +{ + int i; + i = 0; + while (i < 4) + { + if (left == 1) + x[0] = 4; + else if (right == 1) + x[3] = 4; + else if (i >= (left - 1) && i <= (4 - right)) + x[i] = 4; + i++; + } +} + +void ft_putchar(char c) +{ + write(1, &c ,1); +} + +int main(void) +{ + int matrix[4][4] = {{0}}; + + int str[16] = {3, 3, 1, 2, 1, 2, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3}; + + int a; + int e; + int g; + + a = 0; + e = 12; + g = 8; + + while (a < 4) + { + change_to_max(matrix[a], str[g], str[e]); + g++; + e++; + a++; + } + + 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 matrix2[4][4] = {{0}}; + +}
\ No newline at end of file |
