www.bilisim-egitim.tr.gg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Karmaşık Sayılarda İşlemler |
|
|
Karmaşık sayılar üzerinde işlem yapan program
#include <stdio.h> /* printf,scanf */
#include <stdlib.h> /* EXIT_SUCCESS */
struct complex_s
{
float re;
float im;
};
typedef struct complex_s complex_t;
complex_t add_complex(complex_t c1, complex_t c2);
int main(void)
{
complex_t n1, n2, n3;
printf("Birinci sayıyı yazın: "); scanf("%f %f", &n1.re, &n1.im);
printf("İkinci sayıyı yazın: "); scanf("%f %f", &n2.re, &n2.im);
n3 = add_complex(n1, n2);
printf("Toplam: %f + %fin", n3.re, n3.im);
return EXIT_SUCCESS;
}
struct complex_s add_complex(struct complex_s c1, struct complex_s c2)
{
complex_t c3;
c3.re = c1.re + c2.re;
c3.im = c1.im + c2.im;
return c3;
/*www.bilisim-egitim.tr.gg*/
}
|
|
|
|
|
|
|
Bugün 144 ziyaretçi (226 klik)
www.bilisim-egitim.tr.gg
|
|
|
|
|
|
|
|