39 lines
625 B
C
39 lines
625 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", "Lines count: "line_count);
|
|
|
|
return 0;
|
|
}
|
|
|