Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void longestcharnotinset(int*, int*, int, int);
- int main() {
- cout << " Enter size of set : ";
- int N;
- cin >> N;
- int* set = new int[N];
- for (int i = 0; i < N; i++) {
- cin >> set[i];
- }
- int M;
- cout << "How many numbers do you want to check for? : ";
- cin >> M;
- cout << "Enter " << M << " numbers from the set : \n";
- int* subset = new int[M];
- for (int i = 0; i < M; i++) {
- cin >> subset[i];
- }
- longestcharnotinset(set, subset,N,M);
- cout << endl;
- return 0;
- }
- void longestcharnotinset(int* set, int* subset, int N, int M)
- {
- int* longestnum = nullptr;
- int cnt = 0, cntcpy = 0;
- int firstnum;
- int lastnum;
- for (int i = 0; i < 10; i++) {
- for (int j = i; j < M; j++) {
- if (set[i] == subset[j]) cnt++;
- if (cntcpy < cnt) cntcpy = cnt;
- }
- }
- std::cout << "The highest cound of elements in a row in the set is " << cntcpy << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement