From 0690bb3eba9e9901e115c1245c566560ac935b84 Mon Sep 17 00:00:00 2001
From: Bohdana Marchenko <bohdana.marchenko@student.tuke.sk>
Date: Thu, 6 Mar 2025 10:43:15 +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 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/du2/program.c b/du2/program.c
index 2bba378..5af0590 100644
--- a/du2/program.c
+++ b/du2/program.c
@@ -5,22 +5,23 @@
 
 #define LINE_SIZE 100
 
-int read_double(double *value) {
+int read_double(double *value, int coef_index) {
     char line[LINE_SIZE];
     if (fgets(line, LINE_SIZE, stdin) == NULL) {
-        return 0; // Chyba pri čítaní
+        return 0; 
     }
     char *endptr;
     *value = strtod(line, &endptr);
     if (endptr == line || (*endptr != '\0' && *endptr != '\n')) {
-        return 0; // Neplatný vstup
+        printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index);
+        return 0; 
     }
     return 1;
 }
 
 int main() {
     double x;
-    if (!read_double(&x)) {
+    if (!read_double(&x, 1)) {
         printf("Chyba: Nepodarilo sa načítať hodnotu x.\n");
         return 1;
     }
@@ -30,7 +31,7 @@ int main() {
     int coef_count = 0;
 
     while (1) {
-        if (!read_double(&coef)) {
+        if (!read_double(&coef, coef_count + 2)) {
             if (coef_count == 0) {
                 printf("Chyba: Neboli zadané žiadne koeficienty.\n");
                 return 1;