pvjc24/cv1/program.c

27 lines
422 B
C
Raw Normal View History

2024-02-23 13:00:03 +00:00
#include <stdio.h>
2024-02-24 19:23:56 +00:00
2024-02-24 19:02:50 +00:00
int main() {
2024-02-25 20:23:20 +00:00
int c;
int lineCount = 0;
2024-02-24 19:02:50 +00:00
2024-02-25 20:23:20 +00:00
while ((c = getchar()) != EOF) {
if (c >= 'a' && c <= 'z') {
c = c - 'a' + 'A';
} else if (c >= 'A' && c <= 'Z') {
c = c - 'A' + 'a';
2024-02-24 19:02:50 +00:00
}
2024-02-25 20:23:20 +00:00
if (c == '\n') {
lineCount++;
2024-02-24 19:23:56 +00:00
}
2024-02-25 20:20:22 +00:00
2024-02-25 20:23:20 +00:00
putchar(c);
2024-02-23 12:58:04 +00:00
}
2024-02-24 19:02:50 +00:00
2024-02-25 20:23:20 +00:00
2024-02-25 20:46:52 +00:00
printf("\nLines␣count:%d\n",lineCount);
2024-02-24 19:02:50 +00:00
return 0;
2024-02-23 12:58:04 +00:00
}