当前位置:网站首页>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;
边栏推荐
- DML statement of MySQL Foundation
- Hands on deep learning (46) -- attention mechanism
- leetcode1-3
- Latex learning insertion number - list of filled dots, bars, numbers
- Exercise 9-4 finding books (20 points)
- 对于程序员来说,伤害力度最大的话。。。
- Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
- Linked list operation can never change without its roots
- MongoDB数据日期显示相差8小时 原因和解决方案
- Histogram equalization
猜你喜欢
Devop basic command
leetcode842. Split the array into Fibonacci sequences
Rhsca day 11 operation
system design
OSPF comprehensive experiment
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Latex learning insertion number - list of filled dots, bars, numbers
What is an excellent architect in my heart?
RHCE day 3
Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment
随机推荐
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 2
leetcode1-3
DCL statement of MySQL Foundation
Velodyne configuration command
leetcode1-3
【Day1】 deep-learning-basics
Introduction to tree and binary tree
Delayed message center design
用数据告诉你高考最难的省份是哪里!
Histogram equalization
leetcode1229. Schedule the meeting
Rhcsa operation
Evolution from monomer architecture to microservice architecture
[200 opencv routines] 218 Multi line italic text watermark
View CSDN personal resource download details
leetcode729. My schedule 1
Exercise 9-5 address book sorting (20 points)
Press the button wizard to learn how to fight monsters - identify the map, run the map, enter the gang and identify NPC
Sword finger offer 31 Stack push in and pop-up sequence
Four characteristics and isolation levels of database transactions