-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
58 lines (53 loc) · 1.03 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Author: 八尺妖剑
* Date: 2023/5/7
* Email: ilikexff@gmail.com
* Blog: https://waer.ltd
* Desc: main函数入口
**/
#include "LinkList/_LinkList.h"
#include <iostream>
#include "Queue/SqQueue.h"
using namespace std;
void PrintLinkList(LinkList L) {
LinkList p = L->next;
while (p != nullptr) {
std::cout << p->data << " ";
p = p->next;
}
}
/*
int main()
{
LinkList L;
CreateLinkList_R(L);
if (InsertLinkList(L,4,88))
cout <<"success!\n";
else
cout <<"fail!"<<endl;
if(DeleteLinkList(L,2))
cout <<"delete success!\n";
PrintLinkList(L);
return 0;
}
*/
int main()
{
SqQueue Q;
InitQueue(Q);
// 测试入队
EnQueue(Q, 1);
EnQueue(Q, 2);
EnQueue(Q, 3);
// 测试出队
int e;
while (DeQueue(Q, e))
{
std::cout << "Dequeued element: " << e << std::endl;
}
// 测试取队头元素
EnQueue(Q, 4);
int head = GetHead(Q);
std::cout << "Queue head element: " << head << std::endl;
return 0;
}