格式修改

This commit is contained in:
iridiumR 2021-11-18 20:54:44 +08:00
parent d86571bd80
commit fad43a0246
3 changed files with 13 additions and 3 deletions

View file

@ -38,7 +38,7 @@ public:
{ {
if (temp[i].back() < come.front()) if (temp[i].back() < come.front())
{ {
printf("将车厢%d引入缓冲轨道%d \n", come.front(), i + 1); printf("%d号车厢推入#%d缓冲轨 \n", come.front(), i + 1);
temp[i].enqueue(come.dequeue()); temp[i].enqueue(come.dequeue());
} }
else else
@ -60,8 +60,12 @@ public:
{ {
if(temp[j].front()==i) if(temp[j].front()==i)
{ {
printf("将缓冲轨道%d中的车厢%d引入出发序列\n", j+1,temp[j].front()); printf("%d号车厢经#%d缓冲轨推入出发区出发队列为 ", j+1,temp[j].front());
out.enqueue(temp[j].dequeue()); out.enqueue(temp[j].dequeue());
for (int i = 0; i < out.size(); i++)
printf("%d ", out[i]);
printf("\n");
i++; i++;
} }
} }

View file

@ -46,7 +46,7 @@ public:
Node find(int i); Node find(int i);
T remove(T i); T remove(T i);
int operator[](int i) T operator[](int i)
{ {
Node p = first(); Node p = first();
while (0 < i--) while (0 < i--)

View file

@ -9,6 +9,12 @@ class Queue
private: private:
List<T> q; List<T> q;
public: public:
T operator[](int i)
{
return q[i];
}
int size() int size()
{ {
return q.size(); return q.size();