#include<stdio.h>
struct complex {
int real;
int imag;
};
struct complex multiply(struct complex x, struct complex y)
{
int real;
int imag;
real = x.real * y.real -x.imag * y.imag;
imag = x.real * y.imag+x.imag * y.real;
};
int main()
{
struct complex product, x, y;
scanf_s("%d%d%d%d", &x.real, &x.imag, &y.real, &y.imag);
product =multiply(x, y);
printf("(%d+%di)*(%d+%di)=%d+%di\n", x.real, x.imag, y.real, y.imag, product.real, product.imag);
return 0;
}
调试发现i前面永远是1,解释不了为什么错,有没有会的把改对的代码发出来