diff --git a/src/funktion.c b/src/funktion.c index 471a731..2e9cfe9 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -169,3 +169,33 @@ float Vmultiplier3(float x3,float m) { double result = x3 * m; return result; } +double Vparallel(double x1, double x2, double x3, double z1, double z2, double z3) { + double i, j, k; + double X1, X2, X3; + if (x1 > z1) { + X1 = x1 / z1; + i = X1 * 100; + } else { + X1 = z1 / x1; + i = X1 * 100; + } + if (x2 > z2) { + X2 = x2 / z2; + j = X2 * 100; + } else { + X2 = z2 / x2; + j = X2 * 100; + } + if (x3 > z3) { + X3 = x3 / z3; + k = X3 * 100; + } else { + X3 = z3 / x3; + k = X3 * 100; + } + if (i == j && j == k) { + return 0; + } else { + return 1; + } +} diff --git a/src/funktion.h b/src/funktion.h index ab237ea..0a6e9f4 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -34,5 +34,6 @@ float Vsubstract3(float x3, float z3); float Vmultiplier(float x1,float m); float Vmultiplier2(float x2,float m); float Vmultiplier3(float x3,float m); +double Vparallel(double x1, double x2, double x3, double z1, double z2, double z3); #endif diff --git a/src/main.c b/src/main.c index 516598c..7ccf028 100644 --- a/src/main.c +++ b/src/main.c @@ -144,5 +144,22 @@ int main() x3 = getValue('X'); m = getValue('M'); Vmultiplier3(x3, m); + + printf("1. Vektor\n"); + printf("x eingeben"); + x1_1 = getValue('X'); + printf("y eingeben "); + x2_2 = getValue('X'); + printf("z eingeben "); + x3_3 = getValue('X'); + + printf("2. Vektor\n"); + printf("a eingeben"); + z1_1 = getValue('Z'); + printf("b eingeben"); + z2_2 = getValue('Z'); + printf("c eingeben"); + z3_3 = getValue('Z'); + Vparallel(x1, x2, x3, z1, z2, z3); }