C++ Program to Copy Array Elements into Other Array

Write a program to copy of one array into second array for given data elements.



Source Code
#include<iostream>
using namespace std;

int main()
{
    int copy[5], paste[5], i;

    cout<<"Enter 5 array elements to copy\n";
    /* Input marks of 10 students */
    for(i=0; i<5; i++)
        cin>>copy[i];

    /* Logic to copy array elements from first into second */
    for(i=0; i<5; i++)
    {
        paste[i] = copy[i];
    }

    /* Print copied elements */
    cout<<"\nAfter copy second array becomes\n";
    for(i=0; i<5; i++)
        cout<<paste[i]<<" ";

    return 0;
}
Output
Enter 5 array elements to copy
45 75 67 59 124

After copy second array becomes
45 75 67 59 124