当前位置:网站首页>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;
边栏推荐
- Servlet基本原理与常见API方法的应用
- Hands on deep learning (46) -- attention mechanism
- Histogram equalization
- Work order management system OTRs
- From programmers to large-scale distributed architects, where are you (2)
- DCL statement of MySQL Foundation
- Knapsack problem and 0-1 knapsack problem
- Architecture introduction
- MySQL case
- System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
猜你喜欢

【OpenCV 例程200篇】218. 多行倾斜文字水印

Rhcsa learning practice

Reasons and solutions for the 8-hour difference in mongodb data date display

5g/4g wireless networking scheme for brand chain stores

Work order management system OTRs

Vs201 solution to failure to open source file HPP (or link library file)

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

Sword finger offer 05 (implemented in C language)

From programmers to large-scale distributed architects, where are you (I)

Four characteristics and isolation levels of database transactions
随机推荐
MySQL case
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
Exercise 9-3 plane vector addition (15 points)
Differences among opencv versions
VLAN part of switching technology
OSPF summary
Delayed message center design
Es advanced series - 1 JVM memory allocation
Knapsack problem and 0-1 knapsack problem
Leetcode48. Rotate image
Four characteristics and isolation levels of database transactions
Development guidance document of CMDB
Hlk-w801wifi connection
Exercise 9-4 finding books (20 points)
5g/4g wireless networking scheme for brand chain stores
Seven examples to understand the storage rules of shaped data on each bit
leetcode1229. Schedule the meeting
Batch distribution of SSH keys and batch execution of ansible
Network disk installation
PHP代码审计3—系统重装漏洞