From d091362935f1c766b58e1d3af75d8e7806dbc708 Mon Sep 17 00:00:00 2001 From: Bohdana Marchenko Date: Thu, 6 Mar 2025 12:54:27 +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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/du2/program.c b/du2/program.c index 3a7fbb5..f0ba180 100644 --- a/du2/program.c +++ b/du2/program.c @@ -12,10 +12,8 @@ int read_double(double *value, int coef_index) { return 0; } - line[strcspn(line, "\r\n")] = 0; - if (strlen(line) == 0) { return 0; } @@ -23,9 +21,12 @@ int read_double(double *value, int coef_index) { char *endptr; *value = strtod(line, &endptr); - if (endptr == line || *endptr != '\0') { - printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index); + if (coef_index == 1) { + printf("Nepodarilo sa nacitat zaklad x\n"); + } else { + printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index); + } return -1; } @@ -61,7 +62,6 @@ int main() { result = result * x + coef; } - printf("Vysledok je: %.2f\n", result); return 0; -} \ No newline at end of file +}