初始化第四题

This commit is contained in:
2024-10-24 00:47:53 +08:00
parent 58bf747395
commit 8d3fdd54dd
5 changed files with 42 additions and 0 deletions
+2
View File
@@ -13,3 +13,5 @@ add_executable(test2 test2.cpp
add_executable(test3 test3.cpp add_executable(test3 test3.cpp
SeqQueue.cpp SeqQueue.cpp
SeqQueue.h) SeqQueue.h)
add_executable(test4 LinkQueue.cpp LinkQueue.h
test4.cpp)
+6
View File
@@ -0,0 +1,6 @@
//LinkQueue.cpp
#include "LinkQueue.h"
#include<iostream>
using namespace std;
+7
View File
@@ -0,0 +1,7 @@
//LinkQueue.h
#ifndef LINKQUEUE_H
#define LINKQUEUE_H
#endif //LINKQUEUE_H
+18
View File
@@ -5,5 +5,23 @@
using namespace std; using namespace std;
int main() { int main() {
SeqQueue q;
initSeqQueue(q);
if (isEmpty(q)) {
//判断队空
cout << "此队伍为空" << endl;
}
for (int i = 1; i <= MAX_SIZE; i++) {
enQueue(q, i); //入队
}
if (isFull(q)) {
//判断队满
cout << "此队伍已满" << endl;
}
while (!isEmpty(q)) {
cout << deQueue(q) << " "; //出队
}
cout << endl;
return 0; return 0;
} }
+9
View File
@@ -0,0 +1,9 @@
//test4.cpp
#include"LinkQueue.h"
#include<iostream>
using namespace std;
int main() {
return 0;
}