How to concatenate two arrays in C++
#include< iostream>using namespace std;
int main()
{
int n,i;
cost< < " Painting size ";
cin> > n;
int a[n],b[n],c[n*2];
cost< < "Table A"< < endl;
for(i=0; i< n; i++)
{
cost< < "a[ "< < i< < " ] = ";
cin> > a[i];
}
cost< < "Table B"< < endl;
for(i=0; i< n; i++)
{
cost< < "b[ "< < i< < " ] = ";
cin> > b[i];
}
//Merge A and B into C
for(i=0; i< n; i++)
{
c[i]=a[i];
c[n*2-(n-i)]=b[i];
}
//Result of the merge
cost< < "C = [ ";
for(i=0; i< 2*n; i++)
cost< < c[i]< < " ";
cost< < " ] ";
return 0;
}