#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <string>
#include <functional>
#include<iterator>

using namespace std;

int main()
{
  list<string> list1;
  list1.push_back("A");
  list1.push_back("B");
  list1.push_back("C");

  list<string>::iterator list_iter1;
  for (list_iter1 = list1.begin(); list_iter1 != list1.end(); ++list_iter1)
  {
    cout << *list_iter1 << " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  fill(list1.begin(), list1.end(), "D");
  for (list_iter1 = list1.begin(); list_iter1 != list1.end(); ++list_iter1)
  {
    cout << *list_iter1 << " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  list<string> list2;
  for (int k=0;k<12;k++)
  {
    list2.push_back("E");
  }

  list<string>::iterator list_iter2;
  for (list_iter2 = list2.begin(); list_iter2 != list2.end(); ++list_iter2)
  {
    cout << *list_iter2 << " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  fill_n(list2.begin(), 9, "F");
  for (list_iter2 = list2.begin(); list_iter2 != list2.end(); ++list_iter2)
  {
    cout << *list_iter2 << " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  list<int> list3;
  generate_n(back_inserter(list3), 5, rand);

  list<int>::iterator list_iter3;
  for (list_iter3 = list3.begin(); list_iter3 != list3.end(); ++list_iter3)
  {
    cout << *list_iter3<< " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  generate(list3.begin(), list3.end(), rand);
  for (list_iter3 = list3.begin(); list_iter3 != list3.end(); ++list_iter3)
  {
    cout << *list_iter3 << " ";
  }
  cout << endl;
  cout << "------------------------------------------" << endl;

  system("pause");
  return 0;
}

====================================================

A B C
------------------------------------------
D D D
------------------------------------------
E E E E E E E E E E E E
------------------------------------------
F F F F F F F F F E E E
------------------------------------------
41 18467 6334 26500 19169
------------------------------------------
15724 11478 29358 26962 24464
------------------------------------------
请按任意键继续. . .

最新文章

  1. oracle SEQUENCE 创建, 修改,删除
  2. java 过滤表情符号
  3. Hadoop Pipeline详解[摘抄]
  4. [问题]数据库MySQL和Navicat的乱码问题
  5. Swift开发之 (01) 语法
  6. C++ dll调用
  7. 迪士尼黑科技:爬墙机器人 VertiGo
  8. cmd 登录oracle
  9. php 类 成员变量 $this-&gt;name=&#39;abc&#39;
  10. debian 显示器使用自定义分辨率
  11. poj 1850 1019 (简单位数dp)
  12. PHP打开PDO_MySQL扩展的配置方法
  13. perl 自动登陆网站发短信
  14. 基于PaaS和SaaS研发的商业云平台实战 转 (今后所有的IT行业会持续集成,往虚拟化方向更快更深的发展,商业化才是这些技术的最终目的)
  15. struts2增删改查---layer---iframe层
  16. Ubuntu17.04安装wps
  17. SQL基础学习_02_查询
  18. 【转】JavaWeb编码之get方式中文乱码问题
  19. Python VisibleDeprecationWarning: converting an array with ndim &gt; 0 to an index will result in an error in the future
  20. LeetCode - 767. Reorganize String

热门文章

  1. 07_Azkaban工作流调度器简介及其安装
  2. Oracle 11g Dataguard 配置,维护与详解 (ADG)
  3. go语言defer关键字背后的实现,语法,用法
  4. 使用Tampermonkey,实现Gitlab禁用自我Merge的功能
  5. linux实操_shell
  6. AKS素性检测
  7. java内存溢出定位
  8. zabbix通过钉钉报警
  9. P4160 [SCOI2009]生日快乐 搜索
  10. [HNOI2008] 越狱 快速幂