Commit 163c1f75 by trkall

tunniyl 08.03 jaoks

parent 1b30055b
fgs Loom 13
fasgs Loom 132
gsa Lind 132
asgsa Lind 13
asf Kala 12
assdf Kala 12
sal Putukas 835
assal Putukas 832
......@@ -23,7 +23,11 @@ int main(void)
Ryhm *n = (Ryhm*)malloc(sizeof(Ryhm*));
F1 = fopen("F1.txt", "r");
if (chkFile(F1) == 0)
{
printf("Andmete fail puudub, sulgen programmi!\n");
return 0;
}
while(!feof(F1) || i <= MAX)
{
n = (Ryhm*)realloc(n, 35);
......
1.12
4.78
5.57
8.12
3.14
2.28
1.11
69.69
12.41
4.20
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 FileSisse(double* Aarr, FILE *sisse)
{
int i = 0;
int y;
while(fscanf(sisse, "%d", &y) != EOF)
double y;
while( !feof(sisse))
{
fscanf(sisse, "%lf", &y);
*(Aarr+i) = y;
i++;
}
return i-1;
}
void t66tlus(double *Aarr, double *Barr, int X)
void t66tlus(double* Aarr, double* Barr, int X, int pikkus)
{
int i;
int j = 0;
int k;
for(i=0;j<15;i++)
for(i=0;j<pikkus;i++)
{
*(Barr+i) = 0;
if(i !=0)
......@@ -30,6 +32,7 @@ void t66tlus(double *Aarr, double *Barr, int X)
*(Barr+i) /= pov(X, i);
}
}
}
int pov(int a, int b)
......@@ -39,4 +42,5 @@ int pov(int a, int b)
{
a*=a;
}
return a;
}
#include <stdio.h>
#include "functions.c"
int FileSisse(double* , FILE *sisse);
void t66tlus(double*, double*, int , int );
int pov(int , int );
int main(void)
{
FILE *sisse;
double *Aarr, *Barr;
int X, i;
double* Aarr;
double* Barr;
int X, i, pikkus;
sisse = fopen("andmed.txt", "r");
FileSisse(Aarr, sisse);
pikkus = FileSisse(Aarr, sisse);
fclose(sisse);
printf("Sisestage X:\n");
scanf("%d", &X);
t66tlus(Aarr, Barr, X);
for(i=0;i<15;i++)
t66tlus(Aarr, Barr, X, pikkus);
for(i=0;i<pikkus;i++)
{
printf("%0.2f", *(Barr+i));
}
......
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