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

边栏推荐
- 写了多年业务代码,我发现了这11个门道,只有内行才知道
- 动态修改el-tab-pane 的label(整理)
- 边缘计算与小程序也能结合!智能家居是否能借势上台阶
- [MySQL] DQL related operations
- # # yyds dry goods inventory interview will brush TOP101: to determine whether there is a part of the list
- 抽象类和接口(学习笔记)
- HF2022-EzPHP reproduction
- 第一节 zadig 入门
- Detailed operator
- Compressing Deep Graph Neural Networks via Adversarial Knowledge Distillation
猜你喜欢
![[MySQL] DQL related operations](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[MySQL] DQL related operations

uniapp folding box secondary loop

Computer shortcut icon whitening solution

Reverse linked list - head insertion inversion method

Reverse linked list - in-place inversion method

IJCAI2022教程 | 口语语言理解:最新进展和新领域

2021GDCPC广东省大学生程序设计竞赛 H.History

mysql 中手动设置事务提交

二进制序列

Week 19 Progress (Understanding IoT Basics)
随机推荐
2022中国物流产业大会暨企业家高峰论坛在杭州举办!
写了多年业务代码,我发现了这11个门道,只有内行才知道
# # yyds dry goods inventory interview will brush TOP101: to determine whether there is a part of the list
[MySQL] Related operations on databases and tables in MySQL
#Dasctf July Enabler WP
A detailed explanation: SRv6 Policy model, calculation and drainage
Kotlin特殊类
如何在 AWS 中应用 DevOps 方法?
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 H.Take the Elevator
Compressing Deep Graph Neural Networks via Adversarial Knowledge Distillation
mysql锁机制
实验8(vlan实验)
机器学习1一回归模型(二)
align-content、justify-content、align-items三个属性的作用和效果
阿里云视频点播+项目实战
第十九周进度(了解物联网基础知识)
JS中? ?和??=和?.和 ||的区别
Summary of BFS questions
reindex win10
智能创意中的尺寸拓展模块