Обновить du2/program.c
This commit is contained in:
parent
2989939eb5
commit
d091362935
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user