第一题:
#include<stdio.h>
struct complex
{
double x,y;
double m;
};
struct complex multi(struct complex a, struct complex b)
{
struct complex c;
c.x=(a.x*b.x)-(a.y*b.y);
c.y=(a.x*b.y)+(a.y*b.x);
return c;
}
void main()
{
struct complex s1, s2, z;
struct complex multi(struct complex a, struct complex b);
printf("Input:\n");
scanf("%lf%lf",&s1.x,&s1.y);
scanf("%lf%lf",&s2.x,&s2.y);
z=multi(s1,s2);
printf("%.2f%+.2fi\n",z.x,z.y);
}
#include<stdio.h>
struct complex
{
double x,y;
double m;
};
struct complex multi(struct complex a, struct complex b)
{
struct complex c;
c.x=(a.x*b.x)-(a.y*b.y);
c.y=(a.x*b.y)+(a.y*b.x);
return c;
}
void main()
{
struct complex s1, s2, z;
struct complex multi(struct complex a, struct complex b);
printf("Input:\n");
scanf("%lf%lf",&s1.x,&s1.y);
scanf("%lf%lf",&s2.x,&s2.y);
z=multi(s1,s2);
printf("%.2f%+.2fi\n",z.x,z.y);
}