Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- #define TAB '\t';
- void main()
- {
- srand(time(NULL));
- const int sz = 10;
- int alpha[sz];
- int beta[sz];
- int gamma[sz];
- for (int i = 0; i < sz; i++)
- cout << (alpha[i] = rand() % 5) << TAB;
- cout << endl << endl;
- for (int i = 0; i < sz; i++)
- cout << (beta[i] = rand() % 5) << TAB;
- for (int i = 0; i < sz; i++)
- for (int j = 0; j < sz; ++j)
- if (alpha[i] == beta[j]) gamma[i] = alpha[i];
- cout << endl << endl;
- int tmp;
- for (int i = 0; i < sz; ++i)
- for (int j = i + 1; j < sz; ++j)
- if (gamma[i] == gamma[j]) gamma[i] = -(INT_MAX);
- for (int i = 0; i < sz; i++)
- if (gamma[i] >= 0) cout << gamma[i] << TAB;
- cout << endl << endl;
- }
Add Comment
Please, Sign In to add comment