Доделал 46е задание
This commit is contained in:
parent
5d875464a3
commit
973e407a45
6 changed files with 41 additions and 21 deletions
20
46Ex/solution_polynomial.c
Normal file
20
46Ex/solution_polynomial.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "solution_polynomial.h"
|
||||
|
||||
int solutionPolynomial(FILE * file, double x, double * derivative, double * polynomial) {
|
||||
double current;
|
||||
|
||||
if (fscanf(file, "%lf", ¤t) != 1) {
|
||||
printf("File is empty!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
*derivative = *polynomial = 0;
|
||||
|
||||
do {
|
||||
*derivative = *derivative * x + *polynomial;
|
||||
*polynomial = *polynomial * x + current;
|
||||
// c4x^3 + c3x^2 + c2x + c = c = c2x + c = c3x^2 + c2x + c = ...
|
||||
} while (fscanf(file, "%lf", ¤t) == 1);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue