当前位置:网站首页>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;
}

边栏推荐
- mysql中关于存储过程无法实现迁移复制表中数据问题
- [0x800706D9] solution appears in Microsoft Store
- Reverse linked list - head insertion inversion method
- PyTorch model export to ONNX file example (LeNet-5)
- uniapp折叠框二级循环
- 【LeetCode】64. 最小路径和 - Go 语言题解
- 解决一个Mysql的utf8编码导致的问题
- PS基础学习(一)
- Detailed operator
- uniapp develops WeChat applet - soft exam brushing applet
猜你喜欢
随机推荐
"Wei cup" school more than 2022 cattle summer camp 4 Nancy (polocy) pelosi article variance law of Arts
Apache Doris系列之:深入认识实时分析型数据库Apache Doris
解决一个Mysql的utf8编码导致的问题
2022中国物流产业大会暨企业家高峰论坛在杭州举办!
2022 China Logistics Industry Conference and Entrepreneur Summit Forum will be held in Hangzhou!
vulnhub靶机AI-Web-1.0渗透笔记
【LeetCode】42. 接雨水 - Go 语言题解
mysql锁机制
“由于找不到MSVCP140.dll,无法继续执行代码,重新安装程序可能会解决此问题等”解决方案
proemthues 服务发现配置
Data cleaning - ingest using es
【LeetCode】70. 爬楼梯 - Go 语言题解
mysql中关于存储过程无法实现迁移复制表中数据问题
“蔚来杯“2022牛客暑期多校训练营2 H.Take the Elevator
Day016 类和对象
The problem of sticky packets in tcp protocol transmission
flex布局父项常见属性flex-wrap
详解操作符
Apache Doris series: In-depth understanding of real-time analytical database Apache Doris
Go语学习笔记 - gorm使用 - 表增删改查 Web框架Gin(八)









