DiffEreD
1436 / 773 / 95
Регистрация: 21.06.2011
Сообщений: 1,740
|
17.10.2012, 13:30
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| #include <iostream>
#include <algorithm>
#include <array>
#include <iterator>
using namespace std;
int main()
{
const int sizeOfa = 8;
const int sizeOfb = 3;
array<int, sizeOfa> a = {1,3,4,5,35,23,4,0};
array<int, sizeOfb> b = {5,35,23};
auto pos = find(a.begin(), a.end(), b[0]);
if (pos != a.end())
{
if (equal(pos, pos+sizeOfb, b.begin()))
cout<<"Yes: "<<distance(a.begin(), pos)<<endl;
else
cout<<"No\n";
}
else
cout<<"No\n";
system("pause");
return 0;
} |
|
0
|