🎨 format file

This commit is contained in:
Kim Yang
2020-08-14 04:44:10 +08:00
parent 55af098154
commit ce38701c86
25 changed files with 325 additions and 55 deletions

View File

@@ -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();