From ff4066a083a196cae3f9b78e58585add14889566 Mon Sep 17 00:00:00 2001 From: fdai6887 Date: Tue, 7 Feb 2023 01:10:38 +0100 Subject: [PATCH] add Vangle --- src/funktion.c | 9 +++++++++ src/funktion.h | 1 + src/main.c | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 7b84e5a..f7b25cc 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -227,3 +227,12 @@ float Vskalort(float x1, float x2, float x3, float z1, float z2, float z3) { } return result; } +double Vangle(float x1, float x2, float x3, float z1, float z2, float z3) { + double i = x1 * z1 + x2 * z2 + x3 * z3; + double p = sqrt(x1 * x1 + x2 * x2 + x3 * x3); + double q = sqrt(z1 * z1 + z2 * z2 + z3 * z3); + double s = i / (p * q); + double t = acos(s) * 180 / M_PI; + printf("Der Winkel betraegt: %f\n\n", t); + return 11; +} diff --git a/src/funktion.h b/src/funktion.h index 9032e72..e579e16 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -39,5 +39,6 @@ float Vmiddle(float x1, float z1); float Vmiddle2(float x2, float z2); float Vmiddle3(float x3, float z3); float Vskalort(float x1, float x2, float x3, float z1, float z2, float z3); +double Vangle(float x1, float x2, float x3, float z1, float z2, float z3); #endif diff --git a/src/main.c b/src/main.c index b809317..e90e88d 100644 --- a/src/main.c +++ b/src/main.c @@ -173,4 +173,22 @@ int main() z2 = getValue('Z'); z3 = getValue('Z'); Vskalort(x1, x2, x3, z1, z2, z3); + + printf("1. Vektor\n"); + printf("1. Vektor\n"); + printf("x eingeben"); + x1 = getValue('X'); + printf("y eingeben "); + x2 = getValue('X'); + printf("z eingeben"); + x3 = getValue('X'); + + printf("2. Vektor\n"); + printf("a eingeben"); + z1 = getValue('Z'); + printf("b eingeben "); + z2 = getValue('Z'); + printf("c eingeben"); + z3 = getValue('Z'); + Vangle(x1,x2,x3,z1,z2,z3); }