include iostream using namespace std class queue public queue queue qu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using namespace std;
class queue
{
public:
queue();
queue(queue& str);
~queue();
void push(const int v);
void pop();
bool isempty() const;
private:
struct node
{
node* pPrev_;
node* pNext_;
int data_;
};
node* pHead_ = nullptr;
};
int main()
{
queue a;
return 0;
};
queue::queue() = default;
queue::~queue()
{
while (isempty())
{
pop();
}
}
void
queue::push(const int v)
{
node* pnew = new node;
pnew->pNext_ = pHead_;
pnew->data_ = v;
pHead_ = pnew;
}
bool
queue::isempty() const
{
return (nullptr == pHead_);
}
void
queue::pop()
{
}