Start New Discussion within our Software Development Community

Make flow chart from this code, how ?

#include <stdio.h>
#include <math.h>
struct point
{
        double x, y;
};
struct point input_point()
{
        struct point a;
        printf("x = ");
        scanf("%lf", &a.x);
        printf("y = ");
        scanf("%lf", &a.y);
        return a;
}
struct point reverse(struct point v)
{
        struct point w;
        w.x = -v.x;
        w.y = -v.y;
       return w;
}
struct point make_vector(struct point a, struct point b)
{
        struct point v;
        v.x = b.x - a.x;
        v.y = b.y - a.y;
        return v;
}
double dot_product(struct point a, struct point b)
{
        return a.x * b.x + a.y * b.y;
}
double len(struct point v)
{
        return sqrt(dot_product(v, v));
}
double v_cosine(struct point v1, struct point v2)
{
        return dot_product(v1, v2) / (len(v1) * len(v2));
}
double sine_half(double cos)
{
        return sqrt((1 - cos) / 2);
}
int main()
{
        struct point a, b, c, ab, bc, ac;
        printf("Vavedete A:\n");
        a = input_point();
        printf("Vavedete B:\n");
        b = input_point();
        printf("Vavedete C:\n");
        c = input_point();
        ab = make_vector(a, b);
        bc = make_vector(b, c);
        ac = make_vector(a, c);
        printf("sin(alpha / 2) = %.4f\n", sine_half(v_cosine(ab, ac)));
        printf("sin(beta / 2) = %.4f\n", sine_half(v_cosine(reverse(ab), bc)));
        printf("sin(gamma / 2) = %.4f\n", sine_half(v_cosine(reverse(bc), reverse(ac))));
}
This article has been dead for over six months. Start a new discussion instead.