初始化第四题
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
//LinkQueue.cpp
|
||||||
|
|
||||||
|
#include "LinkQueue.h"
|
||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
//LinkQueue.h
|
||||||
|
|
||||||
|
#ifndef LINKQUEUE_H
|
||||||
|
#define LINKQUEUE_H
|
||||||
|
|
||||||
|
|
||||||
|
#endif //LINKQUEUE_H
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
//test4.cpp
|
||||||
|
#include"LinkQueue.h"
|
||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user