diff --git a/cv1/program.c b/cv1/program.c index 89c0ecd..8d9e1a2 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,25 +1,29 @@ #include -#include int main() { - int line_count = 0; - char input_char; + int c; + int lineCount = 0; - while ((input_char = getchar()) != EOF) { - if (input_char == '\n') { - line_count++; + while ((c = getchar()) != EOF) { + if (c >= 'a' && c <= 'z') { + + c = c - 'a' + 'A'; + } else if (c >= 'A' && c <= 'Z') { + + c = c - 'A' + 'a'; } - if (islower(input_char)) { - input_char = toupper(input_char); - } else if (isupper(input_char)) { - input_char = tolower(input_char); + if (c == '\n') { + + lineCount++; } - putchar(input_char); + + putchar(c); } - printf("\nLines␣count:%d\n", line_count); + + printf("\nPočet načítaných riadkov: %d\n", lineCount); return 0; }