From 9f3f30fe2c41e325f4c3ad900d6a0c496b72ef52 Mon Sep 17 00:00:00 2001 From: Yaroslav Orlianskyi Date: Tue, 1 Mar 2022 19:01:36 +0100 Subject: [PATCH] SAD --- du1/program.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/du1/program.c b/du1/program.c index 7cb165e..60a051f 100644 --- a/du1/program.c +++ b/du1/program.c @@ -3,23 +3,31 @@ int main(){ int c = 0; int a = 0; + int counter = 0; char small[] = "abcdefghijklmnopqrstuvwxyz"; char big[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char d; - while( c != EOF){ + while(c = 1){ c = getchar(); d = c; int a = 0; + if(d == '\n'){ + counter++; + break; + } while(a > 26){ if(d == small[a]){ - c = big[a]; + d = big[a]; break; }else if(d == big[a]){ - c = small[a]; + d = small[a]; break; - } + } + a++; } + c = d; putchar (c); } + printf("\nPočet riadkov: %d\n",counter); return 0; }