pvjc24/cv1/program.c

26 lines
496 B
C
Raw Normal View History

2024-02-23 13:00:03 +00:00
#include <stdio.h>
2024-02-25 20:20:22 +00:00
#include <ctype.h>
2024-02-24 19:23:56 +00:00
2024-02-24 19:02:50 +00:00
int main() {
int line_count = 0;
2024-02-25 20:20:22 +00:00
char input_char;
2024-02-24 19:02:50 +00:00
2024-02-25 20:20:22 +00:00
while ((input_char = getchar()) != EOF) {
if (input_char == '\n') {
line_count++;
2024-02-24 19:02:50 +00:00
}
2024-02-25 20:20:22 +00:00
if (islower(input_char)) {
input_char = toupper(input_char);
} else if (isupper(input_char)) {
input_char = tolower(input_char);
2024-02-24 19:23:56 +00:00
}
2024-02-25 20:20:22 +00:00
putchar(input_char);
2024-02-23 12:58:04 +00:00
}
2024-02-24 19:02:50 +00:00
2024-02-25 20:20:22 +00:00
printf("\nLines␣count:%d\n", line_count);
2024-02-24 19:02:50 +00:00
return 0;
2024-02-23 12:58:04 +00:00
}