Deletion in an array..

 

#include<iostream.h>
#include<conio.h>
void main()
{
cout<<"Enter the values of array";
int pos,a[7],i,val;//a[n]
for(i=0;i<7;i++)
{
cin>>a[i];
}
for(i=0;i<7;i++)
{
cout<<a[i];
}
//after deletion
cout<<"Enter the positon to be deleted";
cin>>pos;
int j=6;//n-1
while (pos<=6)
{
a[pos]=a[pos+1];
pos++;
}
for(int k=0;k<6;k++)
{
cout<<a[k]<<" ";
}
getch();
}
Posted by lol ik

Comments

Popular Posts