diff --git a/cv1/program.c b/cv1/program.c index 466e1f0..05af661 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,26 +1,26 @@ #include -#include int main() { - int lines_count = 0; int c; + int lines = 0; while ((c = getchar()) != EOF) { - if (islower(c)) { - putchar(toupper(c)); - } else if (isupper(c)) { - putchar(tolower(c)); - } else { + if (c >= 'a' && c <= 'z') { + c -= 32; + } else if (c >= 'A' && c <= 'Z') { + c += 32; + } + + if (c == '\n') { + lines++; + } + + if (c >= 32 && c <= 126) { putchar(c); - if (c == '\n') { - lines_count++; - } } } - printf("Počet načítaných riadkov: %d\n", lines_count); + printf("\nPočet načítaných riadkov: %d\n", lines); return 0; - - -} \ No newline at end of file +}