Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- using namespace std;
- int main()
- {
- int n;
- srand(time(0));
- n = rand() % 8 + 2;
- int *A = new int[n];
- for (int i = 0; i < n; i++)
- {
- A[i] = 2*i+1;
- cout << A[i] << " ";
- }
- cout << endl;
- int *B = new int[n];
- for (int i = 0; i < n; i++)
- {
- B[i] = 2*(i+1);
- cout << B[i] << " ";
- }
- cout << endl;
- int tn = n + n;
- int *C = new int[tn];
- for (int i = 0; i < tn; i += 2)
- {
- C[i] = A[i / 2];
- C[i + 1] = B[i / 2];
- cout << C[i] << " " << C[i + 1] << " ";
- }
- delete[] A;
- delete[] B;
- delete[] C;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement