//Deletion in One Dimension Aray
#include<iostream.h>
#include<conio.h>
main()
{
int a[50];
int i,j,k,n,item;
cout<<"Enter No Of Elements in Array";
cin>>n;
cout<<"Enter Array Elements";
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"enter the place where, item to delete:";
cin>>k;
item=a[k-1];
for(i=k;i<n;i++)
{
a[k-1]=a[k];
}
n=n-1;
cout<<"The New Array"<<endl;
for(i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
}
#include<iostream.h>
#include<conio.h>
main()
{
int a[50];
int i,j,k,n,item;
cout<<"Enter No Of Elements in Array";
cin>>n;
cout<<"Enter Array Elements";
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"enter the place where, item to delete:";
cin>>k;
item=a[k-1];
for(i=k;i<n;i++)
{
a[k-1]=a[k];
}
n=n-1;
cout<<"The New Array"<<endl;
for(i=0;i<n;i++)
cout<<a[i]<<" ";
getch();
}
No comments:
Post a Comment