当前位置:网站首页>Write a program to judge whether the elements contained in a vector < int> container are 9.20: exactly the same as those in a list < int> container.
Write a program to judge whether the elements contained in a vector < int> container are 9.20: exactly the same as those in a list < int> container.
2022-07-04 10:26:00 【qq_ fifty-eight million seven hundred and thirty-six thousand t】
#include<iostream>
#include<list>
#include<vector>
using namespace std;
int main(void)
{
vector<int> vc; int value;
list<int> ls;
cout << " Please enter vector Container elements by ctrl+z sign out " << endl;
while (cin >> value)
vc.push_back(value);
cin.ignore();
cin.clear();
cout << " Please enter list Container elements by ctrl+z sign out " << endl;
while (cin >> value)
ls.push_back(value);
vector<int>::iterator iter1 = vc.begin();
list<int>::iterator iter2 = ls.begin();
if (vc.size() == ls.size())
{
while (*iter1++ == *iter2++)
{
if (iter1 == vc.end() && iter2 == ls.end())
{
cout << " The elements of the two containers are exactly the same " << endl;
break;
}
}
}
if (vc.size() != ls.size())
cout << " The elements of the two containers are different " << endl;
return 0;
边栏推荐
- Intelligent gateway helps improve industrial data acquisition and utilization
- Velodyne configuration command
- AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
- 今日睡眠质量记录78分
- C language structure to realize simple address book
- DCL statement of MySQL Foundation
- 对于程序员来说,伤害力度最大的话。。。
- Latex insert picture, insert formula
- The future education examination system cannot answer questions, and there is no response after clicking on the options, and the answers will not be recorded
- Basic data types of MySQL
猜你喜欢
[200 opencv routines] 218 Multi line italic text watermark
The future education examination system cannot answer questions, and there is no response after clicking on the options, and the answers will not be recorded
Servlet基本原理与常见API方法的应用
Dynamic address book
Doris / Clickhouse / Hudi, a phased summary in June
IPv6 comprehensive experiment
Number of relationship models
今日睡眠质量记录78分
Static comprehensive experiment ---hcip1
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
随机推荐
From programmers to large-scale distributed architects, where are you (2)
今日睡眠质量记录78分
Pod management
Exercise 7-4 find out the elements that are not common to two arrays (20 points)
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
OSPF summary
Software sharing: the best PDF document conversion tool and PDF Suite Enterprise version sharing | with sharing
Rhcsa learning practice
Rhcsa operation
System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
IPv6 comprehensive experiment
Rhsca day 11 operation
Dynamic memory management
Custom type: structure, enumeration, union
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
Batch distribution of SSH keys and batch execution of ansible
Latex error: missing delimiter (. Inserted) {\xi \left( {p,{p_q}} \right)} \right|}}
Sword finger offer 31 Stack push in and pop-up sequence
Basic principle of servlet and application of common API methods
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前