From 27db2f6ed3c013887894bc85236e9c5f1afa5445 Mon Sep 17 00:00:00 2001 From: fdai6887 Date: Tue, 7 Feb 2023 01:01:44 +0100 Subject: [PATCH] add Vskalort --- src/funktion.c | 9 +++++++++ src/funktion.h | 1 + src/main.c | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 7841df3..219e073 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -216,3 +216,12 @@ float Vmiddle3(float x3, float z3) { result = result * 0.5; return result; } +float Vskalort(float x1, float x2, float x3, float z1, float z2, float z3) { + float E; + E = x1 * z1 + x2 * z2 + x3 * z3; + if (E == 0) { + return 1; + } else { + return 0; + } +} diff --git a/src/funktion.h b/src/funktion.h index e4e082d..9032e72 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -38,5 +38,6 @@ double Vparallel(double x1, double x2, double x3, double z1, double z2, double z 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); #endif diff --git a/src/main.c b/src/main.c index 8292665..e6a22e9 100644 --- a/src/main.c +++ b/src/main.c @@ -164,4 +164,21 @@ int main() x3 = getValue('X'); z3 = getValue('Z'); Vmiddle3(x3, z3); + + 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'); + Vskalort(x1, x2, x3, z1, z2, z3); }