pvjc24/cv1/program.c
2024-02-25 20:43:48 +01:00

39 lines
604 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) {
return -1;
}
c = (char)input;
c = simulate_caps_lock(c);
putchar(c);
if (c == '\n') {
line_count++;
}
}
printf("%d\n", "Lines count: "line_count);
return 0;
}