#include <iostream>
#include <list>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
  list<string> slist;
  slist.push_back("A");
  slist.push_back("B");
  slist.push_back("C");
  slist.push_back("D");
  slist.push_back("E");
  slist.push_back("F");
  slist.push_back("G");

  list<string>::iterator iter;
  for (iter=slist.begin();iter != slist.end();++iter)
  {
    cout << *iter<< endl;
  }

  cout << "---------------------------------------" << endl;

  string s1("D");
  string s2("F");
  list<string>::iterator iter_start = find(slist.begin(),slist.end(),s1);
  list<string>::iterator iter_end = find(slist.begin(), slist.end(), s2);

  if (iter_start != slist.end() && iter_end != slist.end())
  {
    slist.erase(iter_start,iter_end);
  }

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

  system("pause");
  return 0;
}

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

A
B
C
D
E
F
G
---------------------------------------
---------------------------------------
A
B
C
F
G
---------------------------------------
请按任意键继续. . .

最新文章

  1. 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)
  2. 自然语言处理3.3——使用Unicode进行文字处理
  3. (转)根据IP返回对应的位置信息
  4. ConcurrentHashMap中的2的n次方幂上舍入方法(转)
  5. java学习笔记 --- 抽象类
  6. Git错误一例
  7. jdk各个版本之间的差异
  8. BZOJ 5261 Rhyme
  9. 论文笔记系列-Speeding Up Automatic Hyperparameter Optimization of Deep Neural Networks by Extrapolation of Learning Curves
  10. JMeter中BeanShell断言使用一
  11. servlet 最大线程数探索笔记
  12. 基于SSH实现员工管理系统之框架整合篇
  13. 计时器setInterval()
  14. C语言复习:结构体
  15. Beta阶段第五篇Scrum冲刺博客-Day4
  16. MariaDB 视图与触发器(11)
  17. Tracing 在PeopleSoft 程序中怎么开启
  18. Hadoop分布式远程Debug方式
  19. angularjs中audio/video 路径赋值问题
  20. java 数据结构与算法---递归

热门文章

  1. Visual studio 2010 打开高版本VS工程解决办法
  2. python-----多线程笔记
  3. 成功解决 AttributeError: module &#39;tensorflow.python.keras.backend&#39; has no attribute &#39;get_graph&#39;
  4. React 新特性学习
  5. input 设置 display:none后 jquery无法给input赋值
  6. bug提交遵循的规则
  7. [2019HDU多校第二场][HDU 6591][A. Another Chess Problem]
  8. 常见http响应状态码(status)
  9. 使用Ajax向SpringMVC传递Json数据
  10. Python3读写JSON文件