📄 s3.cpp
字号:
// s3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stackQueue.h"
int main(int argc, char* argv[])
{
queueList<int> ql1,ql2;
ql1.makeEmpty(); ql2.makeEmpty();
int c[9] = {5, 6, -8,3,-4,-9,0,1,7};
for(int i=1; i<9; i++) {
if(c[i]>c[i-1]) ql1.enQueue(c[i]);
else{
while(!ql1.isEmpty()) ql2.enQueue(ql1.deQueue());
ql1.enQueue(c[i]);
while(!ql2.isEmpty()) ql1.enQueue(ql2.deQueue());
}
}
cout<<"ql1中为:"; //ql1为:-9,-4,-8,6,3,0,1,7
while(!ql1.isEmpty()) cout<<ql1.deQueue()<<", ";
cout<<endl;
cout<<"ql2中为:"; //ql2为:
while(!ql2.isEmpty()) cout<<ql2.deQueue()<<", ";
cout<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -