News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

What is wrong?

Started by techniker1986, February 24, 2011, 02:09:11 PM

Previous topic - Next topic

techniker1986

#include <stdio.h>
#include <complex.h>
#include <math.h>

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

complex double parallel (complex double, complex double);
int main  (void)
{

complex double z, zl, zc, zr;
zr=6.9;
zl=I*2*3.14159265358979323846*549000*0.0002;                               //for 3.14159265358979323846 -> M_PI
zc=1/(I*2*3.14159265358979323846*549000*0,0000000005);               //for 3.14159265358979323846 -> M_PI
z=parallel (zl+zr, zc);


printf ("Wirkanteil=%lf Ohm\n", creal (z));
printf ("Blindanteil=%lf Ohm\n\n", cimag(z));

printf ("Betrag=%lf Ohm\n", cabs(z));
printf ("Phi im Bogenmass=%lf Rad\n", carg(z));
}
complex double parallel (complex double a, complex double b)
{
return ((a*b)/(a+b));
}

thanks for helo

CommonTater

Ok... what is it doing wrong?

A little more information would be helpful....

frankie

#include <stdio.h>
#include <complex.h>
#include <math.h>

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

complex double parallel (complex double, complex double);
int main  (void)
{

complex double z, zl, zc, zr;
zr=6.9+I*0.0;
zl=0.0+I*2*3.14159265358979323846*549000*0.0002;                               //for 3.14159265358979323846 -> M_PI
zc=0.0+I*1/(2*3.14159265358979323846*549000*0,0000000005);               //for 3.14159265358979323846 -> M_PI
z=parallel (zl+zr, zc);


printf ("Wirkanteil=%lf Ohm\n", creal (z));
printf ("Blindanteil=%lf Ohm\n\n", cimag(z));

printf ("Betrag=%lf Ohm\n", cabs(z));
printf ("Phi im Bogenmass=%lf Rad\n", carg(z));
}
complex double parallel (complex double a, complex double b)
{
return ((a*b)/(a+b));
}
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

MichaelT


CommonTater


techniker1986