#include "SeqQueue.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct PERSON
{
char name[64];
int age;
}Person;
int main(void)
{
//初始化栈区
SeqQueue *stack=InitStack();
//创建数据
//创建数据
Person p1,p2,p3,p4,p5;
strcpy(p1.name,"ggj");
strcpy(p2.name,"zqx");
strcpy(p3.name,"wjy");
strcpy(p4.name,"lx");
strcpy(p5.name,"wjy");
p1.age=22;
p2.age=23;
p3.age=21;
p4.age=21;
p5.age=21
Push_SeqQueue(stack,&p1);
Push_SeqQueue(stack,&p2);
Push_SeqQueue(stack,&p3);
Push_SeqQueue(stack,&p4);
Push_SeqQueue(stack,&p5);
//输出
while(Size_SeqQueue(stack)>0)
{
Person *person=(Person *)Front_SeqQueue(stack);
printf("Name is %s,Age is %d\n",person->name,person->age);
//弹出栈元素,即删除元素,因为栈不能遍历只能删除
Pop_SeqQueue(stack);
}
FreeSpace(stack);
}
队列的顺序存储测试
最新推荐文章于 2024-11-12 13:55:23 发布