Commit 85991f8e by rakein

Upload new file

parent dea9cf68
Showing with 82 additions and 0 deletions
#include <stdio.h>
#include "pindalaArvutaja.h"
#include "seeStruct.h"
#include "checkFile.h"
#include "v2ljastus.h"
#include "check3Nurk.h"
//#include "externalVariable.h"
extern int MAX = 10;
int sisse(seeStruct X[], int);
int main(void)
{
seeStruct A[MAX];
seeStruct B[MAX];
seeStruct C[MAX];
FILE *S;
int i = 0;
double pindalas[MAX];
int check = 0;
check += sisse(A, 1);
check += sisse(B, 2);
check += sisse(C, 3);
if (check != 0)
{
return 0;
}
for(i=0;i<10;i++)
{
check = check3Nurk(A,B,C, i);
if(check == 0)
{
pindalas[i] = pindala(A, B, C, i);
} else {
pindalas[i] = 0;
}
}
v2ljastus(S, pindalas);
return 0;
}
int sisse(seeStruct X[MAX], int param)
{
FILE *andmed;
int check = 0;
int i = 0;
if (param == 1)
{
andmed = fopen("aAndmed.txt", "r");
check += checkFile(andmed);
} else if (param == 2)
{
andmed = fopen("bAndmed.txt", "r");
check += checkFile(andmed);
} else
{
andmed = fopen("cAndmed.txt", "r");
check += checkFile(andmed);
}
if (check == 0)
{
printf("seda faili pole ");
return 1;
}
while(i<MAX)
{
fscanf(andmed, "%lf %lf", &X[i].x, &X[i].y);
i++;
}
fclose(andmed);
return 0;
}
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