附录 源代码 1
头文件 Car
h #ifndef CAR #define CAR #include using namespace std; typedef struct Node { void *data; struct Node *link; }nodeS; typedef struct Sta { nodeS *top; int count; }Stack; typedef struct NodeQ { void *dataptr; struct NodeQ *next; }nodeQ; typedef struct Queues { int count; nodeQ *front; nodeQ *rear; }Que; Stack *Createstack(); void* pop(Stack *stack); void push(Stack *stack,void *data); void DestroyStack(Stack *stack); Que *CreateQueue(); void Enqueue(Que *queue); void *Dequeue(Que *queue); void Destroyqueue(Que *queue); #endif 2
实现文件Car
cpp #include "Car
h" Stack *Createstack() { Stack *stack; stack = new Stack; if(stack == NULL) return NULL; stack->count = 0; stack->top = NULL; return stack; } void push(Stack *stack,void *data) { nodeS *node; node = new nodeS; if(node == N