Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- using namespace std;
- bool rep(const vector< int> & a, const int &lenght)
- {
- bool rep = 0;
- for (int i = 0; i < lenght; i++)
- {
- int count = 0;
- for (int j = i; j < lenght; j++)
- {
- if (a[i] == a[j])
- {
- count++;
- if (count == 2)
- rep = 1;
- }
- }
- }
- return rep;
- }
- int main()
- {
- vector<int> array = { 6, 9,66,785,632,569,56,654,2,0, 31,23,33};
- cout <<"Задание 8: "<< rep(array,array.size()) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment