All Programs are Written and Compiled in Dev C++. So, it may generate some error in case of other compilers and may need some modifications in program. Download Dev C++

Wednesday 26 February 2014

Deletion in One Dimension Array

//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();
}
                     

No comments:

Post a Comment