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

边栏推荐
猜你喜欢

Manually set transaction commit in mysql

$\text{ARC 145}$

第十九周进度(了解物联网基础知识)

IJCAI2022 Tutorial | Spoken Language Comprehension: Recent Advances and New Fields

2021GDCPC Guangdong University Student Programming Competition H.History

EasyExcel综合课程实战
![[MySQL] Related operations on databases and tables in MySQL](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[MySQL] Related operations on databases and tables in MySQL

二进制序列

HCIP第十六天笔记

#yyds干货盘点# 面试必刷TOP101:判断链表中是否有环
随机推荐
Go语学习笔记 - gorm使用 - 表增删改查 Web框架Gin(八)
MySQL的一个问题
2022 Nioke Summer Multi-School Training Camp 1 J Serval and Essay
proemthues 服务发现配置
Debezium error series 20: task failed to create new topic. Ensure that the task is authorized to create topics
In MySQL, the stored procedure cannot realize the problem of migrating and copying the data in the table
# Dasctf 7月赋能赛 WP
Data cleaning - ingest using es
leetcode:127. Word Solitaire
“蔚来杯“2022牛客暑期多校训练营4 L.Black Hole 垃圾计算几何
“蔚来杯“2022牛客暑期多校训练营4 N.Particle Arts 规律 方差
Achievements of Science and Technology (31)
PS Basic Learning (1)
360核心安全大脑3.0正式发布,构建政企用户的“能力中枢平台”
WebServer流程讲解(注册模块)
HCIP Day 15 Notes
Flex布局使用
leetcode(刷题篇13)
状态机动态规划之股票问题总结
Chevrolet Trailblazer, the first choice for safety and warmth for your family travel