头文件实现:
#ifndef POLYLIST_H
#define POLYLIST_H
//Data Type
#define NULL 0
typedef enum{
_FALSE = 0,
_TRUE
}_BOOL;
typedef struct Polynode{
int coef;//系数
int exp; //指数
struct Polynode* next;
}Polynode,*Polylist;
//Function
void InputData(int* pc,int* pe);
Polylist CreatePoly();
void AddPoly(Polylist polya,Polylist polyb);
#endif
源文件实现:
#include "Polylist.h"
#include <stdio.h>
#include <stdlib.h>
void InputData(int* pc,int* pe)
{
printf("coef=");
scanf("%d",pc);
printf("exp=");
scanf("%d",pe);
}
Polylist CreatePoly()
{
Polynode *head,*tail,*s;
int c,e;
head = (Polynode*)malloc(sizeof(Polynode));//头结点