diff --git a/du2/program.c b/du2/program.c index 3a7fbb5..59ee5ec 100644 --- a/du2/program.c +++ b/du2/program.c @@ -3,10 +3,10 @@ #include #include -#define LINE_SIZE 100 +#define LINE_SIZE 100 //maximalna veľkosť čiary int read_double(double *value, int coef_index) { - char line[LINE_SIZE]; + char line[LINE_SIZE]; //deklaruje pole na uloženie reťazca if (fgets(line, LINE_SIZE, stdin) == NULL) { return 0; @@ -20,8 +20,8 @@ int read_double(double *value, int coef_index) { return 0; } - char *endptr; - *value = strtod(line, &endptr); + char *endptr; // smernik na hľadanie konca reťazca pri prevode na číslo + *value = strtod(line, &endptr); // Prevod reťazca na dvojité číslo if (endptr == line || *endptr != '\0') { @@ -39,13 +39,13 @@ int main() { return 1; } - double coef; - double result = 0; - int coef_count = 0; + double coef; //uloženie koeficientu polynómu + double result = 0; // uloženie výsledku + int coef_count = 0; //Počítadlo počtu zadaných koeficientov - while (1) { + while (1) { //Nekonečný cyklus na zadávanie koeficientov coef_count++; - int status = read_double(&coef, coef_count); + int status = read_double(&coef, coef_count); //Číta koeficient if (status == -1) { return 0;