#include<iostream.h>
void main ()
{
const int size=50;
int a[size],k,i,j,num,n=0;
char ch;
cout<<"Enter the Array and 0 to end"<<endl;
for (i=0;i<size;i++)
{
cin>>a;
if (a==0)break;
n++;
}
cout<<endl;
cout<<"The Array Is :";
for (i=0;i<n;i++)
cout<<a;
while(n<size)
{
cout<<endl<<"Please Enter The New Number :";
cin>>num;
cout<<endl;
cout<<"Please Enter The New Index :";
cin>>k;
cout<<endl;
for (j=n-1;j>=k;j-- )
a[j+1]=a[j];
a[k] = num;
n++;
for (i=0;i<n;i++)
cout<<a<<" ";
cout<<endl;
cout<<"Press y to insert another and n to finish :";
cin>>ch;
if(ch=='n')break;}
}هادا برنامح من أجل حشر عنصر في مصفوفة ياريت تشرحولي القسم الأخير منوا بداية من جملة for (j=n-1;j>=k;j-- )
