diff --git a/homework3/CMakeLists.txt b/homework3/CMakeLists.txt index 884f031..2d482e7 100644 --- a/homework3/CMakeLists.txt +++ b/homework3/CMakeLists.txt @@ -13,3 +13,5 @@ add_executable(test2 test2.cpp add_executable(test3 test3.cpp SeqQueue.cpp SeqQueue.h) +add_executable(test4 LinkQueue.cpp LinkQueue.h + test4.cpp) diff --git a/homework3/LinkQueue.cpp b/homework3/LinkQueue.cpp new file mode 100644 index 0000000..32f8da1 --- /dev/null +++ b/homework3/LinkQueue.cpp @@ -0,0 +1,6 @@ +//LinkQueue.cpp + +#include "LinkQueue.h" +#include + +using namespace std; diff --git a/homework3/LinkQueue.h b/homework3/LinkQueue.h new file mode 100644 index 0000000..02d27b1 --- /dev/null +++ b/homework3/LinkQueue.h @@ -0,0 +1,7 @@ +//LinkQueue.h + +#ifndef LINKQUEUE_H +#define LINKQUEUE_H + + +#endif //LINKQUEUE_H diff --git a/homework3/test3.cpp b/homework3/test3.cpp index 501b2f2..c7f99de 100644 --- a/homework3/test3.cpp +++ b/homework3/test3.cpp @@ -5,5 +5,23 @@ using namespace std; 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; } diff --git a/homework3/test4.cpp b/homework3/test4.cpp new file mode 100644 index 0000000..3c0dc82 --- /dev/null +++ b/homework3/test4.cpp @@ -0,0 +1,9 @@ +//test4.cpp +#include"LinkQueue.h" +#include + +using namespace std; + +int main() { + return 0; +}