//How to remove an element in array using C++.
#include<iostream.h>
#include<conio.h>
void main()
{
int i, k, j, item, data[50], n;
clrscr();
cout<<"Enter the number of elements in the array:";
cin>>n;
cout<<endl<<"Enter the value of "<<n<<" elements:";
for(i=0; i<n; i++)
{
cin>>data[i];
}
cout<<endl<<" Enter the location of item to be deleted:";
cin>>k;
for(j=k;j<n-1; j++)
{
data[j]=data[j+1];
}
n=n-1;
for(i=0;i<n;i++)
{
cout<<endl<<i<<" element is:"<<data[i];
}
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
int i, k, j, item, data[50], n;
clrscr();
cout<<"Enter the number of elements in the array:";
cin>>n;
cout<<endl<<"Enter the value of "<<n<<" elements:";
for(i=0; i<n; i++)
{
cin>>data[i];
}
cout<<endl<<" Enter the location of item to be deleted:";
cin>>k;
for(j=k;j<n-1; j++)
{
data[j]=data[j+1];
}
n=n-1;
for(i=0;i<n;i++)
{
cout<<endl<<i<<" element is:"<<data[i];
}
getch();
}