Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int *b = new int[n];
- int *a = new int[n];
- int cnt = 0;
- for (int i = 0; i != n; ++i)
- {
- a[i] = rand() % 20 * pow(-1, rand() % 12);
- cout << a[i] << '\t';
- if (a[i] % 2 == 0)
- {
- b[cnt++] = a[i];
- }
- }
- cout << endl;
- for (int i = 0; i != cnt; ++i)
- {
- cout << b[i] << '\t';
- }
- delete[] a;
- delete[] b;
- _getch();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement