From e83286b12134ac39f9b397f5a1d3f11e98bae904 Mon Sep 17 00:00:00 2001 From: Filip Chochol Date: Tue, 24 Feb 2026 19:45:38 +0100 Subject: [PATCH] push --- a1/program.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index 33c14ce..345924a 100644 --- a/a1/program.c +++ b/a1/program.c @@ -1,3 +1,45 @@ -int main() { - return 0; +#include +#include + +void CapsLock() { + + int x; + int numlines = 0; + int check = 0; + + while ((x = getchar()) != EOF) { + + if (x == '\n') { + putchar('\n'); + numlines++; + } + else if (islower(x)) { + putchar(x - 'a' + 'A'); + check = 1; + } + + else if (isupper(x)) { + putchar(x - 'A' + 'a'); + check = 1; + } + else if (x >= 32 && x <= 126) { + putchar(x); + } + } + + printf("Pocet riadkov: %d\n", numlines); + + if (check) { + printf("Vo vstupe sa nachadzalo aspon jedno pismeno.\n"); + } else { + printf("Vo vstupe sa nenachadzalo ziadne pismeno.\n"); + } +} + +int main() { + + CapsLock(); + + return 0; + }