Update 'cv1/program.c'
This commit is contained in:
parent
81e1f67758
commit
d9cc1c347d
@ -3,9 +3,13 @@
|
||||
int main() {
|
||||
int c = 0;
|
||||
int lines_count = 0;
|
||||
int last_char_was_newline = 0;
|
||||
|
||||
while ((c = getchar()) != EOF) {
|
||||
|
||||
last_char_was_newline = 0;
|
||||
|
||||
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
c = c - 'a' + 'A';
|
||||
}
|
||||
@ -16,13 +20,14 @@ int main() {
|
||||
|
||||
if (c == '\n') {
|
||||
lines_count++;
|
||||
last_char_was_newline = 1;
|
||||
}
|
||||
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
|
||||
if (lines_count > 0) {
|
||||
if (!last_char_was_newline) {
|
||||
putchar('\n');
|
||||
}
|
||||
printf("Lines count: %d\n", lines_count);
|
||||
|
Loading…
Reference in New Issue
Block a user