- 8
- 0
- 约1.4千字
- 约 4页
- 2017-06-08 发布于重庆
- 举报
实验5标准模板库的应用吕恩在
( 二〇一五年十二月
标准模板库的应用
实验目的
了解C++标准模板库STL的容器类的使用方法
应用标准C++模板库STL通用算法和函数对象实现查找与排序
实验要求
1.使用C++模板库STL中的双向队列类(deque)重新实现实验九中实验任务。
2.声明一个整型数组,使用C++模板库STL中的查找算法find()进行数据的查找,然后应用排序算法Sort(),并配合使用标准函数对象Greater 对数据进行升序和降序排序
实验内容
1.
#include
#include
using namespace std;
typedef deque ??INTDEQUE;
int main INTDEQUE A; for int i 0;i 5;i++ A.push_back 2*i+1 ; cout 队列A的元素为: ; while !A.empty cout A.front ???; A.pop_front ; cout endl; 2.
#include
#include
#include
using namespace std;
int main int A[8] 5, 2, 7, 4, 4, 2, 6, 1 ; int *location ; int i ; int value ; cout 数组的值为: ; for i
原创力文档

文档评论(0)