24 lines
539 B
C
24 lines
539 B
C
#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));
|
|
} else if (isprint(c) || c == '\t') {
|
|
putchar(c);
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int c; //текущий считанный символ
|
|
int c2 = 0; //счётчик строк
|
|
while ((c = getchar()) !=EOF) {
|
|
funkcia(c, &c2);
|
|
}
|
|
printf("\nLines count: %d\n", c2);
|
|
return 0;
|
|
}
|