53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
/**********************************************************************\
|
|
* Kurzbeschreibung:
|
|
* "Funktionstest" - 2 komplexe Zahlen einlesen
|
|
* und alle implementierten Funktionen aus complex.c zum Test aufrufen
|
|
*
|
|
* Datum: Autor:
|
|
*
|
|
*
|
|
\**********************************************************************/
|
|
|
|
/*--- #includes ------------------------------------------------------*/
|
|
#define _CRT_SECURE_NO_WARNINGS //VC++: keine scanf() Warnungen
|
|
#include <stdio.h>
|
|
#include "complex.h"
|
|
|
|
/*--- #defines -------------------------------------------------------*/
|
|
|
|
/*--- Lokale Datentypen (typedef) ------------------------------------*/
|
|
|
|
/*--- Modulglobale static Variablen ----------------------------------*/
|
|
|
|
/*--- Prototypen lokaler Funktionen ----------------------------------*/
|
|
|
|
/*--- Funktionsdefinitionen ------------------------------------------*/
|
|
|
|
/*--- main -----------------------------------------------------------*/
|
|
int main(void)
|
|
{
|
|
double real = 0, imag = 0;
|
|
|
|
printf("1. Zahl eingeben\nRealteil: ");
|
|
scanf("%lf", &real);
|
|
printf("Imaginaerteil:");
|
|
scanf("%lf", &imag);
|
|
|
|
Complex zahl1 = {real, imag};
|
|
|
|
printf("2. Zahl eingeben\nRealteil: ");
|
|
scanf("%lf", &real);
|
|
printf("Imaginaerteil:");
|
|
scanf("%lf", &imag);
|
|
|
|
Complex zahl2 = {real, imag};
|
|
|
|
printf("\nx = (%.3lf + %.3lf""i)", zahl1.real, zahl1.imag);
|
|
printf("\ny = (%.3lf + %.3lf""i)\n\n", zahl2.real, zahl2.imag);
|
|
|
|
addComplex(zahl1 ,zahl2);
|
|
subComplex(zahl1 ,zahl2);
|
|
mulComplex(zahl1 ,zahl2);
|
|
divComplex(zahl1 ,zahl2);
|
|
}
|