pvjc24/cv1/program.c

30 lines
561 B
C
Raw Normal View History

2024-02-13 17:47:37 +00:00
#include <stdio.h>
2024-02-14 15:36:27 +00:00
#include <ctype.h>
2024-02-13 17:47:37 +00:00
2024-02-14 15:36:27 +00:00
int main() {
int ch;
int visibleChars = 0;
printf("Zadajte text (ukoncite vstup s Ctrl+D):\n");
while ((ch = getchar()) != EOF) {
if (islower(ch)) {
ch = toupper(ch);
} else if (isupper(ch)) {
ch = tolower(ch);
}
if (isprint(ch) || ch == '\n') {
putchar(ch);
if (ch != '\n') {
visibleChars++;
}
}
}
printf("\nPocet načítaných riadkov: %d\n", visibleChars);
return 0;
2024-02-13 17:47:37 +00:00
}
2024-02-14 15:36:27 +00:00