Update 'cv1/program.c'

This commit is contained in:
Michal Utľák 2024-02-21 14:10:00 +00:00
parent e7b42cf0f3
commit 1893ede1a5

View File

@ -1,5 +1,4 @@
#include <stdio.h> #include <stdio.h>
#define TAB_WIDTH 7 #define TAB_WIDTH 7
int main() { int main() {
@ -7,17 +6,17 @@ int main() {
int lines_count = 0; int lines_count = 0;
while ((text = getchar()) != EOF) { while ((text = getchar()) != EOF) {
if (text >= 'a' && text <= 'z') { if (text == '\n') {
text = text - 'a' + 'A';
} else if (text >= 'A' && text <= 'Z') {
text = text - 'A' + 'a';
} else if (text == '\n') {
lines_count++; lines_count++;
} else if (text == '\t') { } else if (text == '\t') {
for (int i = 0; i < TAB_WIDTH; i++) { for (int i = 0; i < TAB_WIDTH; i++) {
putchar(' '); putchar(' ');
} }
continue; 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) { } else if (text < 32 || text == 127) {
continue; continue;
} }