zuoye

扫码查看
#include<stdio.h>
#include<stdlib.h>

typedef struct fushu
{
	int xubu;
	int shibu;
	struct fushu *next;

}fushu_node,*fushu;


int MUL(fushu *A,fushu B,fushu C)
{
	fushu D;
	D.shibu=B.shibu*C.shibu-B.xubu*C.xubu;
	D.xubu=B.shibu*C.xubu+B.xubu*C.shibu

	return D;


}
int ADD(fushu *A,fushu B,fushu C)
{
	fushu D;
	D.shibu=B.shibu+C.shibu;
	D.xubu=B.xubu+C.xubu;
	return D;


}

int SUB(fushu *A,fushu B,fushu C)
{
	fushu D;
	D.shibu=B.shibu-C.shibu;
	D.xubu=B.xubu-C.xubu;
	return D;

}

int DIV(fushu *A,fushu B,fushu C)
{
	fushu D;
	D.shibu=B.shibu*C.shibu+B.xubu*C.xubu;
	D.xubu=B.xubu*C.shibu-B.shibu*C.xubu;

    return D;
}




int main()
{

int i,j=1,k,LEN;
	fushu L,p,q;

	L=(fushu)malloc(sizeof(fushu_node));
	L->next=NULL;
	q=L;
	printf("enter the number of complexnumber:")
		scanf("%d",&LEN);

	for(i=0;i<LEN;i++)
	{
		p=(fushu)malloc(sizeof(fushu_node));
		printf("enter the realpart of number%d ",j)
		scanf("%d",&(p->shibu));
		printf("enter the imagepart of number%d ",j)
		scanf("%d",&(p->xubu));
		p->next=NULL;
		q->next=p;
		q=p;
		j++;
	}

return 0;
}

 e

01-11 11:26
查看更多