Advertisement
Guest User

marging array

a guest
Mar 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.   int a[10],i,j,b[10],a1[30],l1=1,u1,l2=1,u2,u;
  6.   cin>>u1;
  7.   for(i=l1;i<=u1;i++)
  8.   {
  9.       cin>>a[i];
  10.    }
  11.    cin>>u2;
  12.    for(j=l2;j<=u2;j++)
  13.    {
  14.      cin>>b[j];
  15.    }
  16.    u=u1+u2-l1+1;
  17.    for(i=l1;i<=u1;i++)
  18.    {
  19.  
  20.        a1[i]=a[i];
  21.    }
  22.  
  23.    for(i=u1+1,j=l2;i<=u;i++)
  24.    {
  25. {
  26.     a1[i]=b[j];
  27.     j++;
  28. }
  29.    }
  30.    for(i=l1;i<=u;i++)
  31.    {
  32.  
  33.        cout<<a1[i];
  34.    }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement