how to delete an elements in array of structures

Hai Netlanders and Coders
Could some one please point out to me an example to delete an element in an array of structure?Is it same as deleting an element in an array.ie like this....???
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//  to delete an element in an array
#include<iostream.h>
#include<conio.h> // for clrscr() and getch()

void main()
{
   clrscr();
   int a[50],n,t,index,i;
   cout<<"enter no of array:";
   cin>>n;
   for(i=0;i<=n;++i)
      cin>>a[i];
    cout<<"enter element to be deleted:";
    cin>>t;
    for(i=0;i<=n;++i)
      {
        if(a[i]==t)
        index=i;
       }
    for(i=index;i<=n;++i)
        a[i]=a[i+1]
    cout<<"array";
    for(i=0;i<=n;++i)
       cout<<"a[i]<<"\n";
    getch();
 }
 


thanks for your time, cyber dude
Last edited on
The code you showed is invalid. Nevertheless the idea behind the code is correct.:)
Topic archived. No new replies allowed.