#include<stdio.h>
#include<math.h>
struct complex
{
double real;
double imag;
};
void add(struct complex* p, struct complex* q, struct complex* r);
void multiply(struct complex* p, struct complex* q, struct complex* r);
int main()
{
struct complex p;
struct complex q;
struct complex r;
scanf("%lf %lf", p.real, p.imag);
scanf("%lf %lf", q.real, q.imag);
add(&p, &q, &r);
multiply(&p, &q, &r);
}
void add(struct complex* p, struct complex* q, struct complex* r)
{
r->real = p->real + q->real;
r->imag = p->imag + q->imag;
printf("%lf %lf", r->real, r->imag);
}
void multiply(struct complex* p, struct complex* q, struct complex* r)
{
r->real = ((p->real) * (q->real)) - ((p->imag) * (q->imag));
r->imag = ((p->real) * (q->imag)) - ((p->imag) * (q->real));
printf("%lf %lf", r->real, r->imag);
}
복소수 합, 곱 구하는 문제인데 c2039오류 라면서 맴버가 아니라고 실행이 안되는데 왜 그런건가요?
감사합니다!