当前位置:网站首页>Write a program to judge whether the two arrays are equal, and then write a similar program to compare the two vectors.
Write a program to judge whether the two arrays are equal, and then write a similar program to compare the two vectors.
2022-07-04 10:26:00 【qq_ fifty-eight million seven hundred and thirty-six thousand t】
/* Write a program to determine whether the two arrays are equal , Then write a similar program
Ordinal comparison of two vector.*/
/*
bool judge1(size_t* a, size_t* b, int n)
{
for (size_t i = 0; i != n; i++)
if (a[i] != b[i])
return false;
else
return true;
}
int main(void)
{
size_t array[10], array1[11];
for (size_t i = 0; i != 10; i++)
{
array[i] = i;
array1[i] = i;
}
if (judge1(array, array1, 10))
cout << " equal ";
else
cout << " It's not equal ";
return 0;
}
*/
bool judge1(vector<size_t>a, vector<size_t>b, int n)
{
for (size_t i = 0; i != n; i++)
if (a[i] != b[i])
return false;
else
return true;
}
int main(void)
{
vector<size_t>array, array1;
for (size_t i = 0; i != 10; i++)// Array modification for comparison
{
array.push_back(i);
array1.push_back(i);
}
if (judge1(array, array1, 10))
cout << " equal ";
else
cout << " It's not equal ";
return 0;
}
边栏推荐
- Three schemes of ZK double machine room
- RHCE - day one
- Jianzhi offer 04 (implemented in C language)
- Dynamic memory management
- Hands on deep learning (39) -- gating cycle unit Gru
- From programmers to large-scale distributed architects, where are you (I)
- Reprint: summation formula of proportional series and its derivation process
- Map container
- PHP代码审计3—系统重装漏洞
- Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
猜你喜欢
如果不知道這4種緩存模式,敢說懂緩存嗎?

Dynamic address book
If you don't know these four caching modes, dare you say you understand caching?

Hands on deep learning (43) -- machine translation and its data construction

【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法

uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前

Architecture introduction

Today's sleep quality record 78 points

Three schemes of ZK double machine room

【Day1】 deep-learning-basics
随机推荐
RHCE - day one
Software sharing: the best PDF document conversion tool and PDF Suite Enterprise version sharing | with sharing
uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
PHP code audit 3 - system reload vulnerability
Ruby time format conversion strftime MS matching format
[200 opencv routines] 218 Multi line italic text watermark
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
Basic principle of servlet and application of common API methods
Rhsca day 11 operation
原生div具有编辑能力
Histogram equalization
按键精灵打怪学习-识别所在地图、跑图、进入帮派识别NPC
Idea SSH channel configuration
Exercise 9-4 finding books (20 points)
入职中国平安三周年的一些总结
DCL statement of MySQL Foundation
From programmers to large-scale distributed architects, where are you (I)
Dos:disk operating system, including core startup program and command program
leetcode1229. Schedule the meeting
Differences among opencv versions