28 lines
1.0 KiB
C
28 lines
1.0 KiB
C
#include <stdio.h>
|
|
#include "complex.h"
|
|
|
|
int main() {
|
|
double re1, im1, re2, im2;
|
|
printf("1. Zahl eingeben\nRealteil: "); scanf("%lf", &re1);
|
|
printf("Imaginärteil: "); scanf("%lf", &im1);
|
|
printf("2. Zahl eingeben\nRealteil: "); scanf("%lf", &re2);
|
|
printf("Imaginärteil: "); scanf("%lf", &im2);
|
|
Complex *x = createComplex(re1, im1);
|
|
Complex *y = createComplex(re2, im2);
|
|
Complex *sum = addComplex(x, y);
|
|
Complex *diff = subtractComplex(x, y);
|
|
Complex *prod = multiplyComplex(x, y);
|
|
Complex *quot = divideComplex(x, y);
|
|
printf("x = "); printComplex(x);
|
|
printf("y = "); printComplex(y);
|
|
printf("Summe: x + y = "); printComplex(sum);
|
|
printf("Differenz: x - y = "); printComplex(diff);
|
|
printf("Produkt: x * y = "); printComplex(prod);
|
|
printf("Quotient: x / y = "); printComplex(quot);
|
|
freeComplex(x); freeComplex(y);
|
|
freeComplex(sum); freeComplex(diff);
|
|
freeComplex(prod); freeComplex(quot);
|
|
return 0;
|
|
}
|
|
|
|
//gcc TestComplex.c -L. -lcomplex -o TestComplex
|