From 8ec751353837f20f63cf39911a6749d16225e745 Mon Sep 17 00:00:00 2001 From: Bohdana Marchenko Date: Thu, 6 Mar 2025 10:49:06 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20du2/program.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du2/program.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/du2/program.c b/du2/program.c index 285776e..fb551ce 100644 --- a/du2/program.c +++ b/du2/program.c @@ -9,11 +9,10 @@ int read_double(double *value, int coef_index) { char line[LINE_SIZE]; if (fgets(line, LINE_SIZE, stdin) == NULL) { return 0; - } - + } line[strcspn(line, "\r\n")] = 0; - + // Skontrolujeme, či je riadok prázdny if (strlen(line) == 0) { return 0; } @@ -23,7 +22,7 @@ int read_double(double *value, int coef_index) { if (endptr == line || *endptr != '\0') { printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index); - exit(1); + return 0; } return 1; } @@ -45,7 +44,7 @@ int main() { printf("Chyba: Neboli zadané žiadne koeficienty.\n"); return 1; } - break; + return 0; } result = result * x + coef; coef_count++;