Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, n2;
  8.     cin >> n >> n2;
  9.  
  10.     int ciag1[n], ciag2[n2];
  11.  
  12.     for(int i=0; i<n; i++)
  13.     {
  14.         cin >> ciag1[i];
  15.     }
  16.  
  17.     for(int i=0; i<n2; i++)
  18.     {
  19.         cin >> ciag2[i];
  20.     }
  21.  
  22.     int ciag3[n + n2];
  23.  
  24.     for(int i=0; i<n; i++)
  25.     {
  26.         ciag3[i] = ciag1[i];
  27.     }
  28.     for(int i=0; i<n2; i++)
  29.     {
  30.         ciag3[i+n] = ciag2[i];
  31.     }
  32.  
  33.     for(int i=0; i < n+n2-1; i++)
  34.     {
  35.         for (int j=0; j< n+n2-1; j++)
  36.         {
  37.             if(ciag3[j]>ciag3[j+1])
  38.                 swap(ciag3[j], ciag3[j+1]);
  39.         }
  40.     }
  41.  
  42.     for (int i=0; i<n+n2; i++)
  43.     {
  44.         cout << ciag3[i];
  45.     }
  46.  
  47.     cout << endl;
  48.  
  49.  
  50.     for (int i=0; i<n+n2; i++)
  51.     {
  52.         cout << ciag3[i] << endl;
  53.     }
  54.  
  55.  
  56.  
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement