From 1f1de1a06188803c050e6855381dfcf07700de3d Mon Sep 17 00:00:00 2001 From: Weber Date: Thu, 28 Mar 2024 17:51:46 +0000 Subject: [PATCH] test --- a1/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index a18dcf3..ac2ae3c 100644 --- a/a1/program.c +++ b/a1/program.c @@ -8,11 +8,12 @@ int main() { char uloha[MAX_LINE_LENGTH]; while (fgets(uloha, MAX_LINE_LENGTH, stdin) != NULL) { - int cislo1, cislo2, vysledok_zadany; char operacia; + while (getchar() != '\n'); + if (sscanf(uloha, "%d %c %d = %d", &cislo1, &operacia, &cislo2, &vysledok_zadany) != 4) { printf("CHYBA\n"); continue; @@ -20,7 +21,6 @@ int main() { double vysledok_skutocny; - switch (operacia) { case '+': vysledok_skutocny = cislo1 + cislo2;