Update 'cv1/program.c'
This commit is contained in:
parent
9cc5994194
commit
508110160b
@ -1,4 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char ch;
|
char ch;
|
||||||
@ -7,10 +8,14 @@ int main() {
|
|||||||
while ((ch = getchar()) != EOF) {
|
while ((ch = getchar()) != EOF) {
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
line_count++;
|
line_count++;
|
||||||
putchar('\n');
|
|
||||||
} else {
|
} else {
|
||||||
|
if (isprint(ch)) {
|
||||||
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : ((ch >= 'A' && ch <= 'Z') ? (ch + 32) : ch));
|
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : ((ch >= 'A' && ch <= 'Z') ? (ch + 32) : ch));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
putchar(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nLines count: %d\n", line_count);
|
printf("\nLines count: %d\n", line_count);
|
||||||
|
Loading…
Reference in New Issue
Block a user