#include #include typedef struct point { float x; float y; } POINT; float rastojanje(POINT a, POINT b){ return sqrt(pow(a.x-b.x,2) + pow(a.y-b.y,2)); } POINT sredina(POINT a, POINT b){ POINT s; s.x = (a.x+b.x)/2; s.y = (a.y+b.y)/2; return s; } void ucitaj_pogresno(POINT a){ printf("Unesi x koordinatu tacke: \n"); scanf("%f", &a.x); printf("Unesi y koordinatu tacke: \n"); scanf("%f", &a.y); } void ucitaj(POINT *a){ printf("Unesi x koordinatu tacke: \n"); scanf("%f", &a->x); //kraci zapis za &(*a).x printf("Unesi y koordinatu tacke: \n"); scanf("%f", &a->y); //kraci zapis za &(*a).y } main(){ POINT a, b; POINT c = {1,2}; POINT sred; a.x = 3; a.y = 4; b.x = 6; b.y = 8; printf("Rastojanje izmedju tacaka a i b je %.2f\n", rastojanje(a,b)); printf("Rastojanje izmedju tacaka b i c je %.2f\n", rastojanje(b,c)); printf("Rastojanje izmedju tacaka c i a je %.2f\n", rastojanje(c,a)); sred = sredina(a,b); printf("Srediste duzi ab je (%.2f, %.2f)\n", sred.x, sred.y); printf("Koordinate tacke a pre pogresne funkcije: (%.2f, %.2f)\n", a.x, a.y); ucitaj_pogresno(a); printf("Koordinate tacke a posle pogresne funkcije: (%.2f, %.2f)\n", a.x, a.y); printf("Koordinate tacke a pre ispravne funkcije: (%.2f, %.2f)\n", a.x, a.y); ucitaj(&a); printf("Koordinate tacke a posle ispravne funkcije: (%.2f, %.2f)\n", a.x, a.y); } /* domaci float obim(POINT a, POINT b, POINT c); float povrsina(POINT a, POINT b, POINT c); definisati funkciju za ispis strukture POINT */