Advertisement
Josif_tepe

Untitled

Mar 10th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int niza[n];
  10.     for(int i = 0; i < n; i++) {
  11.         cin >> niza[i];
  12.     }
  13.     int m;
  14.     cin >> m;
  15.     int niza2[m];
  16.     for(int i = 0; i < m; i++) {
  17.         cin >> niza2[i];
  18.     }
  19.     int niza3[n + m]; // volkava ke e spoenata niza
  20.     int brojac = 0;
  21.     for(int i = 0; i < n; i++) {
  22.         niza3[brojac] = niza[i];
  23.         brojac++;
  24.     }
  25.     for(int i = 0; i < m; i++) {
  26.         niza3[brojac] = niza2[i];
  27.         brojac++;
  28.     }
  29.     sort(niza3, niza3 + n + m);
  30.     for(int i = 0; i < brojac; i++) {
  31.         cout << niza3[i] << " ";
  32.     }
  33.     return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement