mirror of
https://github.com/CodePanda66/CSPostgraduate-408.git
synced 2023-05-21 21:49:33 +08:00
🎨 format file
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
//
|
||||
// Created by kim yang on 2020/8/1.
|
||||
// Copyright (c) Kim Yang All rights reserved.
|
||||
//
|
||||
|
||||
//循环顺序队列的第二种实现方式
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/**定义模块**/
|
||||
#define MaxSize 10
|
||||
|
||||
typedef struct {
|
||||
@@ -12,7 +15,9 @@ typedef struct {
|
||||
int front,rear;//对头指针和队尾指针
|
||||
int tag;//利用tag变量记录最后一次操作是什么,0为删除,1为插入,并用作判满的条件!有了tag就不会浪费一个存储空间
|
||||
}SqQueue;
|
||||
/**定义模块**/
|
||||
|
||||
/**实现模块**/
|
||||
//初始化
|
||||
void InitQueue(SqQueue &Q){
|
||||
Q.rear=Q.front=0;//初始化时,队头队尾都指向0
|
||||
@@ -50,7 +55,9 @@ bool GetHead(SqQueue Q,int &x){
|
||||
x=Q.data[Q.front];
|
||||
return true;
|
||||
}
|
||||
/**实现模块**/
|
||||
|
||||
/**测试模块**/
|
||||
//打印整个队列
|
||||
void PrintQueue(SqQueue Q){
|
||||
printf("开始打印队列\n");
|
||||
@@ -101,6 +108,7 @@ void TestQueue(){
|
||||
|
||||
printf("结束测试!\n");
|
||||
}
|
||||
/**测试模块**/
|
||||
|
||||
int main(){
|
||||
TestQueue();
|
||||
|
||||
Reference in New Issue
Block a user