C++ 栈和队列的介绍与使用(二)

2015-07-20 17:08:02 · 作者: · 浏览: 12
using namespace std; class T { public: int x,y,z; T(int a,int b,int c):x(a),y(b),z(c) { } }; bool operator<(const T&t1,const T&t2) { return t1.z q; q.push(T(4,4,3)); q.push(T(2,2,5)); q.push(T(1,5,4)); q.push(T(3,3,6)); while(!q.empty()) { T t=q.top(); q.pop(); cout<