Last active
November 17, 2022 05:49
-
-
Save SoxFace/d25d28e99f7bc356d66c80c60ee85c92 to your computer and use it in GitHub Desktop.
Revisions
-
SoxFace revised this gist
Nov 17, 2022 . 1 changed file with 4 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,3 @@ #include <unistd.h> void ft_putchar(char c) @@ -50,8 +38,9 @@ void ft_print_comb2(void) /* EXPECTED 00 01, 00 02, 00 03, 00 04, 00 05, ..., 00 99, 01 02, ..., 97 99, 98 99 */ // 1. FAIL: starts at 00 00 != 00 01 // 2. FAIL: 00 99, 01 01, != 00 99, 01 02 // 3. FAIL: ends on 97 99, 98 9898 99 != 97 99, 98 99 -
SoxFace revised this gist
Nov 17, 2022 . 1 changed file with 34 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,25 +12,46 @@ Expected Output #include <unistd.h> void ft_putchar(char c) { write(1, &c, 1); } void ft_print_comb2(void); int main() { ft_print_comb2(); return 0; } void ft_print_comb2(void) { int num1, num2; for (num1 = 0; num1 <= 98; num1++) { for (num2 = num1; num2 <= 99; num2++) { ft_putchar((num1 / 10) + '0'); ft_putchar((num1 % 10) + '0'); ft_putchar(' '); ft_putchar((num2 / 10) + '0'); ft_putchar((num2 % 10) + '0'); if (num1 != 98) { ft_putchar(','); ft_putchar(' '); } } } } /* EXPECTED 00 01, 00 02, 00 03, 00 04...97 99, 98 99 */ // 1. FAIL: starts at 00 00 instead of 00 01 // 2. FAIL: ends on 97 99, 98 9898 99 instead of 97 99, 98 99 -
SoxFace revised this gist
Nov 17, 2022 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,9 +27,10 @@ int main(void) void ft_print_comb2(void) { // 1. need nested loops // 2. outer loop (int i) needs to start at 00 and go up to 98 // 3. then a space = " "; // 4. inner loop (int j) needs to start the same as i and go up to 99 // 5. then ft_putchar(','); // 6. then ft_putchar(" "); } -
SoxFace revised this gist
Nov 17, 2022 . 1 changed file with 34 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,35 @@ /* ch00 ex06 Create a function that displays all different combination of two digits between 00 and 99, listed by ascending order. Prototype: void ft_print_comb2(void); Expected Output $>./a.out | cat -e 00 01, 00 02, 00 03, 00 04, 00 05, ..., 00 99, 01 02, ..., 97 99, 98 99$> /* #include <unistd.h> void ft_print_comb2(void); void ft_putchar(char c) { write(1, &c, 1); } int main(void) { ft_print_comb2(); return 0; } void ft_print_comb2(void) { // need nested loops // outer loop (int i) needs to start at 00 and go up to 98 // then ft_putchar(','); // then ft_putchar(" "); // inner loop (int j) needs to start the same as i and go up to 99 } -
SoxFace created this gist
Nov 17, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ /* EXPECTED 00 01, 00 02, 00 03, 00 04...97 99, 98 99 */