diff --git a/src/funktion.c b/src/funktion.c index 32c6721..0efda39 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -123,3 +123,12 @@ float Vshift(float x1, float s1) { float result = x1 + s1; return result; } +double Vlength(float x1, float x2, float x3) { + double X1, X2, X3, E; + X1 = x1 * x1; + X2 = x2 * x2; + X3 = x3 * x3; + E = X1 + X2 + X3; + printf("Die laenge das Vektors betraegt: %f\n\n", sqrt(E)); + return sqrt(E); +} diff --git a/src/funktion.h b/src/funktion.h index 182c43c..8cee551 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -24,5 +24,6 @@ double erloesfunktion(double p,double q); double grenzGewinn(double p,double q,double tc); double GewinnMaximum(double p,double q,double tc,double tr); float Vshift(float x1,float s1); +double Vlength(float x1, float x2, float x3); #endif diff --git a/src/main.c b/src/main.c index 4d45e19..86afffd 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ int main() { - double a,b,c,d,h,x1,s1; + double a,b,c,d,h,x1,s1,x2,x3; a = getValue('a'); b = getValue('b'); h = getValue('h'); @@ -103,4 +103,13 @@ int main() x1 = getValue('X'); s1 = getValue('s'); Vshift(x1,s1); + + printf("Vektor\n"); + printf("x eingeben"); + x1 = getValue('X'); + printf("y eingeben "); + x2 = getValue('X'); + printf("z eingeben"); + x3 = getValue('X'); + Vlength(x1, x2, x3); }