Обновить du2/program.c
This commit is contained in:
parent
2f00fb6a0b
commit
8ec7513538
@ -9,11 +9,10 @@ int read_double(double *value, int coef_index) {
|
|||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
if (fgets(line, LINE_SIZE, stdin) == NULL) {
|
if (fgets(line, LINE_SIZE, stdin) == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
line[strcspn(line, "\r\n")] = 0;
|
line[strcspn(line, "\r\n")] = 0;
|
||||||
|
|
||||||
|
// Skontrolujeme, či je riadok prázdny
|
||||||
if (strlen(line) == 0) {
|
if (strlen(line) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -23,7 +22,7 @@ int read_double(double *value, int coef_index) {
|
|||||||
|
|
||||||
if (endptr == line || *endptr != '\0') {
|
if (endptr == line || *endptr != '\0') {
|
||||||
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index);
|
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", coef_index);
|
||||||
exit(1);
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -45,7 +44,7 @@ int main() {
|
|||||||
printf("Chyba: Neboli zadané žiadne koeficienty.\n");
|
printf("Chyba: Neboli zadané žiadne koeficienty.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
result = result * x + coef;
|
result = result * x + coef;
|
||||||
coef_count++;
|
coef_count++;
|
||||||
|
Loading…
Reference in New Issue
Block a user