Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- #include "iomanip"
- #include "time.h"
- #include "algorithm"
- #include "stdlib.h"
- using namespace std;
- int main()
- {
- int const n = 25, m = 37;
- int i, j, a[n], b[m], c[n+m+1], k = 0;
- srand(time(NULL));
- a[0] = rand() % 5;
- for (i = 1; i < n; i++)
- a[i] = a[i - 1] + rand() % 5;
- b[0] = rand() % 5;
- for (j = 1; j < m; j++)
- b[j] = b[j - 1] + rand() % 5;
- for (int i = 0; i < n; i++) {
- bool f = true;
- for (int j = 0; j < m; j++) {
- if (a[i] == b[j]) f = false;
- }
- if (f==true) c[k++] = a[i];
- }
- for (int i = 0; i < n; i++) cout << a[i] << " ";
- cout << endl;
- for (int j = 0; j < m; j++) cout << b[j] << " ";
- cout << endl;
- sort(c ,c + k);
- for (int r = 0; r < k; r++) cout << c[r] << " "; cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement