实验报告5标准模板库的应用.docVIP

  • 44
  • 0
  • 约 3页
  • 2017-06-08 发布于重庆
  • 举报
实验报告5标准模板库的应用

( 二 〇 一 五 年 十 一 月 实验目的 1、了解C++标准模板库STL的容器类的使用方法; 2、应用标准C++模板库STL通用算法和函数对象实现查找与排序; 实验内容 1、使用C++模板库STL中的双向队列类(deque)重新实现实验九中实验任务。 2、声明一个整型数组,使用C++模板库STL中的查找算法find()进行数据的查找,然后应用排序算法Sort(),并配合使用标准函数对象Greater 对数据进行升序和降序排序。 实验程序 1、 #include #include using namespace std; typedef deque INTDEQUE; void main INTDEQUE A; for int i 0;i 5;i++ A.push_back 2*i+1 ; cout 队列A的元素为: endl; while !A.empty cout A.front endl; A.pop_front ; cout endl; 2、 #include #include #include using namespace std; void main int A[8] 5, 2, 7, 4, 4, 2, 6, 1 ; int *location; int i; int value; cout 数

文档评论(0)

1亿VIP精品文档

相关文档