本文整理汇总了C++中PriorityQueue::printQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ PriorityQueue::printQueue方法的具体用法?C++ PriorityQueue::printQueue怎么用?C++ PriorityQueue::printQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PriorityQueue
的用法示例。
在下文中一共展示了PriorityQueue::printQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
cout<<"***********************************\nTesting Priority Linked List\n";
P_LinkedList<int> pll;
for (int i = 0; i < 20; ++i) {
pll.append(i+1);
}
cout<<"Outputting list of size: "<<pll.size()<<endl;
pll.printList();
cout<<"\n\n";
cout<<"Outputting peekMax()\n";
cout<<pll.peekMax()<<endl;
cout<<"Outputting popMax()\n";
cout<<pll.popMax()<<endl;
cout<<"Outputting list of size: "<<pll.size()<<endl;
pll.printList();
cout<<"\n\n";
cout<<"Outputting peekMin()\n";
cout<<pll.peekMin()<<endl;
cout<<"Outputting popMin()\n";
cout<<pll.popMin()<<endl;
cout<<"Outputting list of size: "<<pll.size()<<endl;
pll.printList();
cout<<"\n\n";
cout<<"*****************************************\nTesting Priority Queue\n";
PriorityQueue<int> pq;
for (int i = 0; i < 20; ++i) {
pq.push((rand()%30)+1);
}
cout<<"Outputting list of size: "<<pq.size()<<endl;
pq.printQueue();
cout<<"\n\n";
cout<<"OutPutting front()\n";
cout<< pq.front() <<endl;
cout<<"OutPutting back()\n";
cout<< pq.back() <<endl;
cout<<"\n\n";
cout<<"pop()ing 10 elements\n";
for (int i = 0; i < 10; ++i) {
cout<<pq.pop()<<endl;
}
cout<<"\n\n";
cout<<"Outputting list of size: "<<pq.size()<<endl;
pq.printQueue();
cout<<"\n\n";
cout<<"Instanciating descending object\n";
PriorityQueue<int> pqd(SortOrder::DEC);
for (int i = 0; i < 10; ++i) {
pqd.push((rand()%15)+1);
}
cout<<"Outputting list of size: "<<pqd.size()<<endl;
pqd.printQueue();
cout<<"\n\n";
cout<<"OutPutting front()\n";
cout<< pqd.front() <<endl;
cout<<"OutPutting back()\n";
cout<< pqd.back() <<endl;
cout<<"\n\n";
cout<<"pop()ing 5 elements\n";
for (int i = 0; i < 5; ++i) {
cout<<pqd.pop()<<endl;
}
cout<<"\n\n";
cout<<"Outputting list of size: "<<pqd.size()<<endl;
pqd.printQueue();
cout<<"\n\n";
cout<<"*************************************\nTesting Sorted Linked List\n";
S_LinkedList<int> sll(SortOrder::ASC);
for (int i = 0; i < 100; ++i) {
sll.push((rand()%50)+1);
}
cout<<"Outputting lis of size: "<<sll.size()<<endl;
sll.printList();
cout<<"\n\n";
return 0;
}