From 454fa49d1c164b3269d5f83a006e4016e9adfae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 13:24:35 +0000 Subject: [PATCH 01/11] Update 'cv1/program.c' --- cv1/program.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cv1/program.c b/cv1/program.c index 137c79e..1e8d2d8 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,5 +1,7 @@ #include +#define TAB_WIDTH 4 + int main() { int text; int lines_count = 0; @@ -11,6 +13,11 @@ int main() { text = text - 'A' + 'a'; } else if (text == '\n') { lines_count++; + } else if (text == '\t') { + for (int i = 0; i < TAB_WIDTH; i++) { + putchar(' '); + } + continue; } else if (text < 32 || text == 127) { continue; } @@ -20,4 +27,4 @@ int main() { printf("\nLines count: %d\n", lines_count); return 0; -} +} \ No newline at end of file From 3f1509eb3ee6e78af741e948abfc23c7fb7e0a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 13:29:30 +0000 Subject: [PATCH 02/11] Update 'cv1/program.c' --- cv1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cv1/program.c b/cv1/program.c index 1e8d2d8..152ead5 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,6 +1,6 @@ #include -#define TAB_WIDTH 4 +#define TAB_WIDTH 4 int main() { int text; From e7b42cf0f37de894fa1fe3b14199971b908a541c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 13:47:24 +0000 Subject: [PATCH 03/11] Update 'cv1/program.c' --- cv1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cv1/program.c b/cv1/program.c index 152ead5..51055d6 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,6 +1,6 @@ #include -#define TAB_WIDTH 4 +#define TAB_WIDTH 7 int main() { int text; From 1893ede1a53a528494de6c58efe51668a625b0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:10:00 +0000 Subject: [PATCH 04/11] Update 'cv1/program.c' --- cv1/program.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 51055d6..9b80a82 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,23 +1,22 @@ #include - -#define TAB_WIDTH 7 +#define TAB_WIDTH 7 int main() { int text; int lines_count = 0; while ((text = getchar()) != EOF) { - if (text >= 'a' && text <= 'z') { - text = text - 'a' + 'A'; - } else if (text >= 'A' && text <= 'Z') { - text = text - 'A' + 'a'; - } else if (text == '\n') { + if (text == '\n') { lines_count++; } else if (text == '\t') { for (int i = 0; i < TAB_WIDTH; i++) { putchar(' '); } continue; + } else if (text >= 'a' && text <= 'z') { + text = text - 'a' + 'A'; + } else if (text >= 'A' && text <= 'Z') { + text = text - 'A' + 'a'; } else if (text < 32 || text == 127) { continue; } @@ -27,4 +26,4 @@ int main() { printf("\nLines count: %d\n", lines_count); return 0; -} \ No newline at end of file +} From 9ac43be03d6e0e5786fe41fb8adc9af4244be9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:17:07 +0000 Subject: [PATCH 05/11] Update 'cv1/program.c' --- cv1/program.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 9b80a82..b82efe2 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,5 +1,4 @@ #include -#define TAB_WIDTH 7 int main() { int text; @@ -9,21 +8,19 @@ int main() { if (text == '\n') { lines_count++; } else if (text == '\t') { - for (int i = 0; i < TAB_WIDTH; i++) { - putchar(' '); - } + putchar('\t'); continue; } else if (text >= 'a' && text <= 'z') { - text = text - 'a' + 'A'; + putchar(text - 'a' + 'A'); } else if (text >= 'A' && text <= 'Z') { - text = text - 'A' + 'a'; + putchar(text - 'A' + 'a'); } else if (text < 32 || text == 127) { continue; + } else { + putchar(text); } - - putchar(text); } printf("\nLines count: %d\n", lines_count); return 0; -} +} \ No newline at end of file From 655ba5e29e3f7a793a1eaa23be204a1d5afe0e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:21:26 +0000 Subject: [PATCH 06/11] funguj prosimta --- cv1/program.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index b82efe2..a03143d 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,11 +5,11 @@ int main() { int lines_count = 0; while ((text = getchar()) != EOF) { - if (text == '\n') { - lines_count++; - } else if (text == '\t') { + if (text == '\t') { putchar('\t'); - continue; + } else if (text == '\n') { + lines_count++; + putchar('\n'); } else if (text >= 'a' && text <= 'z') { putchar(text - 'a' + 'A'); } else if (text >= 'A' && text <= 'Z') { @@ -21,6 +21,6 @@ int main() { } } - printf("\nLines count: %d\n", lines_count); + printf("Lines count: %d\n", lines_count); return 0; -} \ No newline at end of file +} From 0728db4408d3d639af5fdcd9e3a7f6dd6d16846f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:24:42 +0000 Subject: [PATCH 07/11] FUNGUJ --- cv1/program.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index a03143d..d3320d4 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,11 +5,12 @@ int main() { int lines_count = 0; while ((text = getchar()) != EOF) { - if (text == '\t') { - putchar('\t'); - } else if (text == '\n') { + if (text == '\n') { + putchar('\n'); lines_count++; - putchar('\n'); + } else if (text == '\t') { + putchar('\t'); + continue; } else if (text >= 'a' && text <= 'z') { putchar(text - 'a' + 'A'); } else if (text >= 'A' && text <= 'Z') { @@ -21,6 +22,6 @@ int main() { } } - printf("Lines count: %d\n", lines_count); + printf("\nLines count: %d\n", lines_count); return 0; } From 78c9d0765bf0796f4755916ec16f7db110bf5ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:30:19 +0000 Subject: [PATCH 08/11] 100 zeby??? --- cv1/program.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index d3320d4..c4628e1 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -11,10 +11,8 @@ int main() { } else if (text == '\t') { putchar('\t'); continue; - } else if (text >= 'a' && text <= 'z') { - putchar(text - 'a' + 'A'); - } else if (text >= 'A' && text <= 'Z') { - putchar(text - 'A' + 'a'); + } else if ((text >= 'a' && text <= 'z') || (text >= 'A' && text <= 'Z')) { + putchar(text ^ ' '); } else if (text < 32 || text == 127) { continue; } else { @@ -25,3 +23,4 @@ int main() { printf("\nLines count: %d\n", lines_count); return 0; } + From 4a19e693a059cda6906bdc67811548e7cb4d0738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:44:32 +0000 Subject: [PATCH 09/11] prosim --- cv1/program.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index c4628e1..48d489c 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -13,14 +13,15 @@ int main() { continue; } else if ((text >= 'a' && text <= 'z') || (text >= 'A' && text <= 'Z')) { putchar(text ^ ' '); - } else if (text < 32 || text == 127) { - continue; - } else { + } else if ((text >= 32 && text < 127) || text == 9) { putchar(text); + } else { + continue; } } printf("\nLines count: %d\n", lines_count); + return 0; } From f9d5a2149e7c256bf92fc7594cf814c208d6608b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 15:37:18 +0000 Subject: [PATCH 10/11] final fix --- cv1/program.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 48d489c..4bb4db3 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -2,12 +2,12 @@ int main() { int text; - int lines_count = 0; + int riadky = 0; while ((text = getchar()) != EOF) { if (text == '\n') { putchar('\n'); - lines_count++; + riadky++; } else if (text == '\t') { putchar('\t'); continue; @@ -20,7 +20,7 @@ int main() { } } - printf("\nLines count: %d\n", lines_count); + printf("\nPocet riadkov: %d\n", riadky); return 0; } From 287b70ad4d6f7b8391320be7da7dddc7076fd407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 15:38:18 +0000 Subject: [PATCH 11/11] nevermind --- cv1/program.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 4bb4db3..42d52bb 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -2,12 +2,12 @@ int main() { int text; - int riadky = 0; + int lines_count = 0; while ((text = getchar()) != EOF) { if (text == '\n') { putchar('\n'); - riadky++; + lines_count++; } else if (text == '\t') { putchar('\t'); continue; @@ -20,8 +20,7 @@ int main() { } } - printf("\nPocet riadkov: %d\n", riadky); + printf("\nLines count: %d\n", lines_count); return 0; -} - +} \ No newline at end of file