Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

trkall / iag0582

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit a389045d authored 8 years ago by trkall's avatar trkall
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

kolmas prax

parent eb621af9 master
Hide whitespace changes
Inline Side-by-side
Showing with 178 additions and 4 deletions
  • praktikum 2.2/F2.txt
  • praktikum 2.2/F2.txt~
  • praktikum 2.2/esimeneKT
  • praktikum 2.2/esimeneKT.c
  • praktikum 2.2/esimeneKT.o
  • praktikum 2.2/huihihih
  • praktikum 2.2/huihihih.c
  • praktikum 2.2/huihihih.o
  • praktikum 2.3/aAndmed.txt
  • praktikum 2.3/aAndmed.txt~
  • praktikum 2.3/bAndmed.txt
  • praktikum 2.3/bAndmed.txt~
  • praktikum 2.3/cAndmed.txt
  • praktikum 2.3/kolmnurgad
  • praktikum 2.3/kolmnurgad.c
  • praktikum 2.3/kolmnurgad.o
praktikum 2.2/F2.txt
View file @ a389045d
fgs Loom 13
fasgs Loom 132
gsa Lind 132
asgsa Lind 13
asf Kala 12
assdf Kala 12
sal Putukas 835
assal Putukas 832
This diff is collapsed. Click to expand it.
praktikum 2.2/F2.txt~ 0 → 100644
View file @ a389045d
fgs Loom 13
fasgs Loom 132
gsa Lind 132
asgsa Lind 13
asf Kala 12
assdf Kala 12
sal Putukas 835
assal Putukas 832
This diff is collapsed. Click to expand it.
praktikum 2.2/esimeneKT 0 → 100644
View file @ a389045d
File added
This diff is collapsed. Click to expand it.
praktikum 2.2/esimeneKT.c
View file @ a389045d
......@@ -18,13 +18,12 @@ int main(void)
char *str3 = "Kala";
char *str4 = "Putukas";
Ryhm *n = malloc(100000);
Ryhm *n = (Ryhm*)malloc(sizeof(Ryhm*));
F1 = fopen("F1.txt", "r");
while(!feof(F1) || i <= MAX)
{
n = (Ryhm*)realloc(n, 350);
n = (Ryhm*)realloc(n, 35);
fscanf(F1,"%s %s %d", (n+i)->Nimi, (n+i)->Liik, &(n+i)->Vanus);
i++;
}
......
This diff is collapsed. Click to expand it.
praktikum 2.2/esimeneKT.o
View file @ a389045d
No preview for this file type
This diff is collapsed. Click to expand it.
praktikum 2.2/huihihih
View file @ a389045d
No preview for this file type
This diff is collapsed. Click to expand it.
praktikum 2.2/huihihih.c
View file @ a389045d
......@@ -70,6 +70,7 @@ int t66tlus(Inimesed *Isik, Inimesed *Uus)
{
strcpy((Uus+j)->nimi, (Isik+i)->nimi);
strcpy((Uus+j)->code, (Isik+i)->code);
(Uus+j)->money = (Isik+i)->money;
j++;
}
......@@ -85,7 +86,7 @@ void v2lja(Inimesed *Uus, int pikkus)
for(i=0;i<pikkus;i++)
{
fprintf(tulemused, "%s %lf %s\n", (Uus+i)->nimi, (Uus+i)->money, CHKCODE);
fprintf(tulemused, "%s %lf %s\n", (Uus+i)->nimi, (Uus+i)->money, (Uus+i)->code);
}
fclose(tulemused);
}
This diff is collapsed. Click to expand it.
praktikum 2.2/huihihih.o
View file @ a389045d
No preview for this file type
This diff is collapsed. Click to expand it.
praktikum 2.3/aAndmed.txt 0 → 100644
View file @ a389045d
12.87 14.78
-45.78 48.14
-87.41 28.47
42.41 -9.47
-1.78 -4.78
17.11 -41.72
-88.11 58.41
42.41 9.26
5.88 4.18
-14.21 44.12
This diff is collapsed. Click to expand it.
praktikum 2.3/aAndmed.txt~ 0 → 100644
View file @ a389045d
12.87 14.78
-45.78 48.14
-87.41 28.47
42.41 -9.47
-1.78 -4.78
17.11 -41.72
-88.11 58.41
42.41 9.26
5.88 4.18
-14.21 44.12
This diff is collapsed. Click to expand it.
praktikum 2.3/bAndmed.txt 0 → 100644
View file @ a389045d
42.87 11.38
-65.78 43.13
-17.41 24.97
44.41 -21.47
-41.78 -55.98
17.11 -1.72
-18.11 8.41
43.41 1.26
6.78 2.18
-13.21 42.12
This diff is collapsed. Click to expand it.
praktikum 2.3/bAndmed.txt~ 0 → 100644
View file @ a389045d
42.87 11.38
-65.78 43.13
-17.41 24.97
44.41 -21.47
-41.78 -55.98
17.11 -1.72
-18.11 8.41
43.41 1.26
6.78 2.18
-13.21 42.12
This diff is collapsed. Click to expand it.
praktikum 2.3/cAndmed.txt 0 → 100644
View file @ a389045d
12.14 24.47
78.42 -12.45
11.11 65.26
79.41 -12.47
97.41 12.56
-33.48 41.62
51.94 12.46
35.63 23.12
-96.74 13.64
89.12 -35.78
This diff is collapsed. Click to expand it.
praktikum 2.3/kolmnurgad 0 → 100644
View file @ a389045d
File added
This diff is collapsed. Click to expand it.
praktikum 2.3/kolmnurgad.c 0 → 100644
View file @ a389045d
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
//#include <math.h>
typedef struct{
float x;
float y;
}Co;
int MAX = 10;
int sisse(Co X[], int);
float *pind(Co A[], Co B[], Co C[]);
int chkFile(FILE *andmed);
int main(void)
{
Co A[10];
Co B[10];
Co C[10];
FILE *S;
int i = 0;
float *pindala;
int chk;
chk += sisse(A, 1);
chk += sisse(B, 2);
chk += sisse(C, 3);
if (chk != 0)
{
return 0;
}
pindala = pind(A, B, C);
return 0;
}
int sisse(Co X[], int param)
{
FILE *andmed;
int chk = 0;
int i = 0;
if (param == 1)
{
andmed = fopen("aAndmed.txt", "r");
chk += chkFile(andmed);
} else if (param == 2)
{
andmed = fopen("bAndmed.txt", "r");
chk += chkFile(andmed);
} else
{
andmed = fopen("cAndmed.txt", "r");
chk += chkFile(andmed);
}
if (chk == 0)
{
printf("A File is missing!");
return 1;
}
while(i<MAX)
{
fscanf(andmed, "%lf %lf", &X[i].x, &X[i].y);
printf("%lf\n", X[i].x);
i++;
}
fclose(andmed);
return 0;
}
float *pind(Co A[], Co B[], Co C[])
{
int i = 0;
float *S = malloc(1000);
for(i=0;i<MAX;i++)
{
*(S+i) = abs((A[i].x * (B[i].y - C[i].y) + B[i].x * (C[i].y - A[i].y) +
C[i].x * (A[i].y - B[i].y)));
}
return S;
}
int chkFile(FILE *andmed)
{
if(andmed == NULL)
{
return 0;
}
return 1;
}
This diff is collapsed. Click to expand it.
praktikum 2.3/kolmnurgad.o 0 → 100644
View file @ a389045d
File added
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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