Update 'cv1/program.c'

This commit is contained in:
Michal Utľák 2024-02-21 14:17:07 +00:00
parent 1893ede1a5
commit 9ac43be03d

View File

@ -1,5 +1,4 @@
#include <stdio.h> #include <stdio.h>
#define TAB_WIDTH 7
int main() { int main() {
int text; int text;
@ -9,21 +8,19 @@ int main() {
if (text == '\n') { if (text == '\n') {
lines_count++; lines_count++;
} else if (text == '\t') { } else if (text == '\t') {
for (int i = 0; i < TAB_WIDTH; i++) { putchar('\t');
putchar(' ');
}
continue; continue;
} else if (text >= 'a' && text <= 'z') { } else if (text >= 'a' && text <= 'z') {
text = text - 'a' + 'A'; putchar(text - 'a' + 'A');
} else if (text >= 'A' && text <= 'Z') { } else if (text >= 'A' && text <= 'Z') {
text = text - 'A' + 'a'; putchar(text - 'A' + 'a');
} else if (text < 32 || text == 127) { } else if (text < 32 || text == 127) {
continue; continue;
} else {
putchar(text);
} }
putchar(text);
} }
printf("\nLines count: %d\n", lines_count); printf("\nLines count: %d\n", lines_count);
return 0; return 0;
} }