pvjc24/cv1/program.c
2024-02-24 20:25:11 +01:00

39 lines
610 B
C

#include <stdio.h>
char simulate_caps_lock(char c) {
if ('a' <= c && c <= 'z') {
return c - ('a' - 'A');
} else if ('A' <= c && c <= 'Z') {
return c + ('a' - 'A');
} else {
return c;
}
}
int main() {
char c;
int line_count = 0;
while (1) {
int input = getchar();
if (input == EOF) {
break; // Koniec súboru (EOF)
}
c = (char)input;
c = simulate_caps_lock(c);
putchar(c);
if (c == '\n') {
line_count++;
}
}
printf("%d\n", line_count);
return 0;
}