Commit 1b30055b by trkall

tunniyl

parent f5bb5b01
No preview for this file type
...@@ -36,5 +36,6 @@ int main(void) ...@@ -36,5 +36,6 @@ int main(void)
faili_lugemine(pikkus, str2, F2, n); faili_lugemine(pikkus, str2, F2, n);
faili_lugemine(pikkus, str3, F2, n); faili_lugemine(pikkus, str3, F2, n);
faili_lugemine(pikkus, str4, F2, n); faili_lugemine(pikkus, str4, F2, n);
free(n);
return 0; return 0;
} }
1.12
4.78
5.57
8.12
3.14
2.28
1.11
69.69
12.41
4.20
void FileSisse(double* Aarr, FILE *sisse)
{
int i = 0;
int y;
while(fscanf(sisse, "%d", &y) != EOF)
{
*(Aarr+i) = y;
i++;
}
}
void t66tlus(double *Aarr, double *Barr, int X)
{
int i;
int j = 0;
int k;
for(i=0;j<15;i++)
{
*(Barr+i) = 0;
if(i !=0)
{
for(k=j;k<=i+1;k++)
{
*(Barr+i) += *(Aarr+j);
}
j=k;
*(Barr+i) *= pov(-1, i);
*(Barr+i) /= pov(X, i);
}
}
}
int pov(int a, int b)
{
int i;
for(i=0;i<b;i++)
{
a*=a;
}
}
#include <stdio.h>
#include "functions.c"
int main(void)
{
FILE *sisse;
double *Aarr, *Barr;
int X, i;
sisse = fopen("andmed.txt", "r");
FileSisse(Aarr, sisse);
printf("Sisestage X:\n");
scanf("%d", &X);
t66tlus(Aarr, Barr, X);
for(i=0;i<15;i++)
{
printf("%0.2f", *(Barr+i));
}
return 0;
}
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment