C++ program to copy all elements of one array to another

Write a C++ program to copy all elements of one array to another?

Write a C++ program to input the values in an array and copy all elements of the first array into the second array.
How to copy array elements to another array in C++. Logic to copy array elements from one array to another array.

Program

#include<iostream>
using namespace std;
int  main()
{
	int p,n,i[100],j[100];
	cout<<"Please enter the size of array :"<<endl;
	cin>>n;
	cout<<"Please enter the 1ST array elements :"<<endl;
	for(p=0;p<n;p++)
	{
	
	cin>>i[p];
}
cout<<"elements of 1st array :"<<endl;
		for(p=0;p<n;p++)
		{
cout<<i[p]<<" ";
}
for(p=0;p<n;p++)
{
j[p]=i[p];
}
cout<<endl<<"element 2nd array :"<<endl;
for(p=0;p<n;p++)
{
cout<<j[p]<<" ";
}
}

Output

program to copy all elements of one array to another array in c++

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.