pvjc25/a1/program.c

24 lines
539 B
C
Raw Normal View History

2025-02-18 16:52:48 +00:00
#include <stdio.h>
#include <ctype.h>
void funkcia (int c, int *line_count) {
if (c == '\n') {
(*line_count)++;
putchar(c);
} else if (isalpha(c)) {
putchar(islower(c) ? toupper(c) : tolower(c));
2025-02-19 12:49:40 +00:00
} else if (isprint(c) || c == '\t') {
putchar(c);
}
2025-02-18 16:52:48 +00:00
}
int main() {
2025-02-20 19:13:08 +00:00
int c; //текущий считанный символ
int c2 = 0; //счётчик строк
2025-02-18 16:52:48 +00:00
while ((c = getchar()) !=EOF) {
funkcia(c, &c2);
}
2025-02-18 17:05:26 +00:00
printf("\nLines count: %d\n", c2);
2025-02-18 16:52:48 +00:00
return 0;
}