当前位置:网站首页>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;
边栏推荐
- Rhcsa learning practice
- Remove linked list elements
- Uniapp--- initial use of websocket (long link implementation)
- Latex insert picture, insert formula
- Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
- Rhcsa day 9
- Dynamic memory management
- Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
- Velodyne configuration command
- Today's sleep quality record 78 points
猜你喜欢
Dynamic address book
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
Rhsca day 11 operation
For programmers, if it hurts the most...
BGP ---- border gateway routing protocol ----- basic experiment
今日睡眠质量记录78分
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
Introduction to extensible system architecture
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
随机推荐
BGP ---- border gateway routing protocol ----- basic experiment
BGP advanced experiment
Basic principle of servlet and application of common API methods
Exercise 9-4 finding books (20 points)
MongoDB数据日期显示相差8小时 原因和解决方案
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
IPv6 comprehensive experiment
Does any teacher know how to inherit richsourcefunction custom reading Mysql to do increment?
Time complexity and space complexity
Recursion and divide and conquer strategy
C language structure to realize simple address book
Exercise 9-5 address book sorting (20 points)
Introduction to tree and binary tree
入职中国平安三周年的一些总结
VLAN part of switching technology
Latex insert picture, insert formula
【OpenCV 例程200篇】218. 多行倾斜文字水印
Ruby时间格式转换strftime毫秒匹配格式
Advanced technology management - how to design and follow up the performance of students at different levels
Lavel document reading notes -how to use @auth and @guest directives in lavel