当前位置:网站首页>46.<list链表的举列>
46.<list链表的举列>
2022-07-30 23:32:00 【李在奋斗……】
【切记呀,在list链表中只能用迭代器进行操作,而且也不能在删除的过程中使用+的符号】
#include <iostream>
#include <list>
using namespace std;
int main()
{
int i = 0;
list<int> list_a(13);
list<int>::iterator it;
for (it=list_a.begin();it!=list_a.end();it++)
{
i++;
cout << "请输入第"<< i<< "个数据" << endl;
cin >> *it;
}
for (it = list_a.begin(); it != list_a.end(); it++)
{
int j = 0;
if (*it == 3)
{
list_a.erase(it, it);
}
else
{
cout << *it << " ";
}
}
return 0;
}
边栏推荐
- uniapp develops WeChat applet - soft exam brushing applet
- ZZULIOJ:1119: 数列有序
- 状态机动态规划之股票问题总结
- Manually set transaction commit in mysql
- flex-direction容器属性
- leetcode 406. Queue Reconstruction by Height 根据身高重建队列(中等)
- mysql 中手动设置事务提交
- Reverse linked list - in-place inversion method
- Mysql进阶优化篇01——四万字详解数据库性能分析工具(深入、全面、详细,收藏备用)
- Reverse linked list - head insertion inversion method
猜你喜欢
随机推荐
Go的Gin框架学习
Reverse linked list - head insertion inversion method
【LeetCode】42. 接雨水 - Go 语言题解
Apache Doris series: In-depth understanding of real-time analytical database Apache Doris
mysql 中手动设置事务提交
Go语学习笔记 - gorm使用 - 事务操作 Web框架Gin(十一)
[MySQL] Mysql transaction and authority management
ZZULIOJ:1119: 数列有序
抽象类和接口(学习笔记)
2022中国物流产业大会暨企业家高峰论坛在杭州举办!
tcp协议传输中的粘包问题
image里的mode属性
解决一个Mysql的utf8编码导致的问题
Detailed operator
软考学习计划
HashSet源码解析
[MySQL] DQL related operations
PyTorch模型导出到ONNX文件示例(LeNet-5)
实验8(vlan实验)
A detailed explanation: SRv6 Policy model, calculation and drainage